28.03.2016, 13:57
Hello, i am trying to make a /giveweapon command, but the problem is, i dont know how to catch the input from the admin after the id, i know how to catch /giveweapon <ID> but not the /giveweapon <id> <weaponid> <ammo>
this is my dcmd command:
The errors that i am getting:
I know its something with the
''new'' lines,
If someone could help me, Thank you in advance!
this is my dcmd command:
Код:
dcmd_giveweapon(playerid, params[]) { new id, n[MAX_PLAYER_NAME], on[MAX_PLAYER_NAME]; new tmp[256],tmp2[256],tmp3[256], Index, str[49]; tmp = strtok(params, Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index), id = strval(tmp), weapon = strval(tmp2), ammo = strval(tmp3); GetPlayerName(id, on, sizeof(on)); GetPlayerName(playerid,n,sizeof(n)); if(PInfo[playerid][Level] < 4) return SendClientMessage(playerid, ORANGE, "You need to be level 4 to use this command!"); if(!strlen(params)) return SendClientMessage(playerid, GREY, "USAGE: /giveweapon <ID> <weaponid> <ammo>"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, GREY, "Invalid ID"); format(str, sizeof(str), "%s gave weapons to %s", n, on); SendClientMessageToAll(ORANGE, str); GivePlayerWeapon(id, weapon, ammo); return 1; }
Код:
error 017: undefined symbol "weapon" error 017: undefined symbol "ammo" error 017: undefined symbol "weapon"
''new'' lines,
If someone could help me, Thank you in advance!