11.05.2018, 07:54
Hi. I saw that you used "i" in the sscanf syntax: if(sscanf(params, "i", option))
Since "option" represents a string, you have to use "s[32]" ("i" stands for integrer, 1, 2, 3, 4, -1, -2, etc.)
So your code must be something like this:
+rep?
Since "option" represents a string, you have to use "s[32]" ("i" stands for integrer, 1, 2, 3, 4, -1, -2, etc.)
So your code must be something like this:
Код:
CMD:takewep(playerid, params[]) { new option[32], string[128], string2[128]; if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You need to login first!"); if(sscanf(params, "s[32]", option)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ptakegun [trousers/pocket]"); } else if(!strcmp(option, "trousers", true)) { if(!GunInfo[playerid][gGun][0]) return SendClientMessage(playerid, -1, "[Error] You don't have a weapon in your trousers pocket."); GivePlayerWeapon(playerid, GunInfo[playerid][gGun][0], GunInfo[playerid][gGunAmmo][0]); GunInfo[playerid][gGun][0] = 0; GunInfo[playerid][gGunAmmo][0] = 0; pInfo[playerid][pTrousers] = 0; GUN(GetPlayerWeapon(playerid))); } else if(!strcmp(option, "pocket", true)) { if(!GunInfo[playerid][gGun][1]) return SendClientMessage(playerid, -1, "[Error] You don't have a weapon in your jacket pocket."); GivePlayerWeapon(playerid, GunInfo[playerid][gGun][1], GunInfo[playerid][gGunAmmo][1]); GunInfo[playerid][gGun][1] = 0; GunInfo[playerid][gGunAmmo][1] = 0; pInfo[playerid][pJacket] = 0; GUN(GetPlayerWeapon(playerid))); } return 1; }