Okay here's an example:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CARTRUNKDEPOSIT)
{
if(response)
{
if(!IsValidWeaponName(inputtext)) return SendClientMessage(playerid, 0xFF0000FF, "You have entered an invalid gun name.");
//Put gun in trunk
//code continues
}
}
return 0;
}
Now as you may have realised... IsValidWeaponName is not an actual function, so I have made a stock function that should operate properly.
pawn Код:
stock IsValidWeaponName(name[])
{
if(strcmp(name, "9mm", true) == 0) return true;
else if(strcmp(name, "colt", true) == 0) return true;
else if(strcmp(name, "silenced 9mm", true) == 0) return true;
else if(strcmp(name, "silenced colt", true) == 0) return true;
else if(strcmp(name, "desert eagle", true) == 0) return true;
else if(strcmp(name, "deagle", true) == 0) return true;
else if(strcmp(name, "shotgun", true) == 0) return true;
else if(strcmp(name, "sawnoff shotgun", true) == 0) return true;
else if(strcmp(name, "sawnoff", true) == 0) return true;
else if(strcmp(name, "combat shotgun", true) == 0) return true;
else if(strcmp(name, "spaz", true) == 0) return true;
else if(strcmp(name, "spaz12", true) == 0) return true;
else if(strcmp(name, "spaz 12", true) == 0) return true;
else if(strcmp(name, "micro smg", true) == 0) return true;
else if(strcmp(name, "smg", true) == 0) return true;
else if(strcmp(name, "uzi", true) == 0) return true;
else if(strcmp(name, "mini uzi", true) == 0) return true;
else if(strcmp(name, "mp5", true) == 0) return true;
else if(strcmp(name, "ak-47", true) == 0) return true;
else if(strcmp(name, "ak47", true) == 0) return true;
else if(strcmp(name, "ak 47", true) == 0) return true;
else if(strcmp(name, "m4", true) == 0) return true;
else if(strcmp(name, "tec 9", true) == 0) return true;
else if(strcmp(name, "tec9", true) == 0) return true;
else if(strcmp(name, "country rifle", true) == 0) return true;
else if(strcmp(name, "rifle", true) == 0) return true;
else if(strcmp(name, "sniper rifle", true) == 0) return true;
else if(strcmp(name, "sniper", true) == 0) return true;
else if(strcmp(name, "rpg", true) == 0) return true;
else if(strcmp(name, "rocket launcher", true) == 0) return true;
else if(strcmp(name, "heatseeker", true) == 0) return true;
else if(strcmp(name, "flamethrower", true) == 0) return true;
else if(strcmp(name, "flame thrower", true) == 0) return true;
else if(strcmp(name, "minigun", true) == 0) return true;
else if(strcmp(name, "mini gun", true) == 0) return true;
return false;
}
This may not be the most effective method to doing it, but it should work. I have also added slang terms such as 'colt' etc. so that players have more than 1 option.