AvestX 5 Odesláno: 17. Únor, 2010 Share Odesláno: 17. Únor, 2010 Dobrý den .. Dávám další TuT .. tato funkce není má ! vytvořil jí DracoBlue, ale vím jak jí použít(vat) tak dávám TuT .. Definace funkce: stock IsNumeric(const string[]) { new length=strlen(string); if (length==0) return false; for (new i = 0; i < length; i++) { if ((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')|| (string[i]=='-' && i!=0)|| (string[i]=='+' && i!=0)) return false; } if (length==1 && (string[0]=='-' || string[0]=='+')) return false; return true; } použití: DCMD asi máte nadefinované tak vytvořte příkaz a třeba takto: dcmd_money(playerid, params[]) { new castka = strval(params); if(!IsNumeric(params)) return SendClientMessage(playerid, 0xFFFFFFFF, "Zadej /money [Castka] !"); // Pokud nezadá číslo GivePlayerMoney(playerid, castka); return 1; } nebo když chcete aby nešlo číslo if(IsNumberic(params)) return SendClientMessage(playerid, 0xFFFFFFFF, "Nesmíš zadat čáslo !"); Link to comment Share on other sites More sharing options...
Om3n 78 Odesláno: 17. Únor, 2010 Share Odesláno: 17. Únor, 2010 je to od "DracoBlue" ... Link to comment Share on other sites More sharing options...
AvestX 5 Odesláno: 17. Únor, 2010 Author Share Odesláno: 17. Únor, 2010 Dik ... doplneno .. Link to comment Share on other sites More sharing options...
Marwin37 5 Odesláno: 18. Únor, 2010 Share Odesláno: 18. Únor, 2010 a mě se zdá že to máš nějaké dlouhé xD Link to comment Share on other sites More sharing options...
AvestX 5 Odesláno: 18. Únor, 2010 Author Share Odesláno: 18. Únor, 2010 Ach náš marw tak si to dej stock IsNumeric(const string[]){new length=strlen(string);if (length==0) return false;for (new i = 0; i < length; i++){if ((string > '9' || string < '0' && string!='-' && string!='+')|| (string=='-' && i!=0)|| (string=='+' && i!=0)) return false;}if (length==1 && (string[0]=='-' || string[0]=='+')) return false;return true;} Link to comment Share on other sites More sharing options...
ATomas 291 Odesláno: 18. Únor, 2010 Share Odesláno: 18. Únor, 2010 j je to dobra funkce chvili sem ji pouzival fuguje jednoduse vlastne porovnava vsecky znaky v retezci a povolene sou 0 1 2 3 4 5 6 7 8 9 - + kdyz tam je jiny znak tak to odesle false jako ze to neni ciselne a kdyz tam sou tyto znaky tak true Link to comment Share on other sites More sharing options...
AvestX 5 Odesláno: 18. Únor, 2010 Author Share Odesláno: 18. Únor, 2010 Přesně atomasi ... Hodí se to třeba když chceš aby sem něco poslal nejákýmu ID a zadá třeba /kill [iD] a místo id dá /kill _aVeStX_ a if(!IsNumberic(params)) return SCM(i, color, "Musis zadat ID !"); a podobne ptakoviny Link to comment Share on other sites More sharing options...
Marwin37 5 Odesláno: 19. Únor, 2010 Share Odesláno: 19. Únor, 2010 Ach náš marw tak si to dej stock IsNumeric(const string[]){new length=strlen(string);if (length==0) return false;for (new i = 0; i < length; i++){if ((string > '9' || string < '0' && string!='-' && string!='+')|| (string=='-' && i!=0)|| (string=='+' && i!=0)) return false;}if (length==1 && (string[0]=='-' || string[0]=='+')) return false;return true;} Pořád moc dlouhé xD hele.... IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string[i] > '9' || string[i] < '0') return 0; return 1; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now