I am using this code for one of my dialogs, to save weapons.
This code is supposed not to allow players to input unknown weapon ids
Code:
if(strval(inputtext) == 35 || strval(inputtext) == 36 || strval(inputtext) == 39 || strval(inputtext) == 44 || strval(inputtext) == 45|| strval(inputtext) == 40) return SCM(playerid, -1, ""er"You can not insert this weapon."); if(strval(inputtext) == 38 && PlayerData[playerid][e_level] != MAX_ADMIN_LEVEL) return SCM(playerid, -1, ":"er"You can not insert this weapon."); if(strval(inputtext) <= 0 && strval(inputtext) >= 47)
So, I have a problem and a question.
Problem: The code which I mentioned above, does nothing, players can still input any number.
Question: How do I not allow them to type letters? I mean, I want to allow them to only type numbers.
Full code:
Code:
case DIALOG_WEAPON_SLOT1: { if(response) { if(PlayerData[playerid][e_gc] >= 100 || PlayerData[playerid][e_vip] == 1) { if(strval(inputtext) == 35 || strval(inputtext) == 36 || strval(inputtext) == 39 || strval(inputtext) == 44 || strval(inputtext) == 45|| strval(inputtext) == 40) return SCM(playerid, -1, ""er"You can not insert this weapon."); if(strval(inputtext) == 38 && PlayerData[playerid][e_level] != MAX_ADMIN_LEVEL) return SCM(playerid, -1, ":"er"You can not insert this weapon."); if(strval(inputtext) <= 0 && strval(inputtext) >= 47) { if(strval(inputtext) == 20) { SCM(playerid, -1, ""er"Invalid weapon ID provided!"); return 1; } SCM(playerid, -1, ""er"Invalid weapon ID provided!"); return 1; } if(PlayerData[playerid][e_vip] != 1) { PlayerData[playerid][e_gc] = PlayerData[playerid][e_gc] - 100; PlayerData[playerid][e_weapon1] = strval(inputtext); SCM(playerid, -1, "{90C3D4}[GC SHOP]{FFFFFF} You have adjusted your first weapon slot for {FF0000}100 {FFFFFF}GC."); } else if(PlayerData[playerid][e_vip] == 1) { PlayerData[playerid][e_weapon1] = strval(inputtext); SCM(playerid, -1, "{90C3D4}[GC SHOP]{FFFFFF} You have adjusted your first weapon slot for {FF0000}FREE."); } } else { SCM(playerid, -1, ""er"You are not a VIP nor have 100 GC."); } } }
This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.
Recommended article from FiveFilters.org: Most Labour MPs in the UK Are Revolting.
Dialog Response
Aucun commentaire:
Enregistrer un commentaire