Command question
#1

Quote:

if(strcmp(subcmd, "arme", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < COFONDA){return NotAdmin(playerid,cmd);}

tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{return SendCmdModelMessage(playerid, "/donnerarme <ID/Pseudo> <Munitions> <Arme ID/Nom>");}
new giveplayerid = ReturnUser(tmp);



new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{idx++;}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{result[idx-offset] = cmdtext[idx]; idx++;}
result[idx - offset] = EOS;
if(!strlen(result))
{return SendCmdModelMessage(playerid, "/donnerarme <ID/Pseudo> <Munitions> <Arme ID/Nom>");}



tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{return SendCmdModelMessage(playerid, "/donnerarme <ID/Pseudo> <Munitions> <Arme ID/Nom>");}
new ammo = strval(tmp);

new amount = GetWeaponModelFromName(result);

GetPlayerName(playerid, playername,sizeof(playername));
GetPlayerName(giveplayerid, giveplayername,sizeof(giveplayername));

SafeGivePlayerWeapon(giveplayerid, amount, ammo);
return 1;
}

Hi,

I want to do this /giveweapon command and I would like to have it with this form:

/giveweapon <ID> <Name Of Weapon> <Ammo>

The problem is that the Name of the Weapon is a string and when I tape the command in game, the ammo part is "taking" by the Name string.

Is there a way to stop the string detection just before the ammo option ?
Reply


Messages In This Thread
Command question - by Etolas - 01.03.2015, 12:00
AW: Command question - by Nero_3D - 01.03.2015, 12:17
Re : Command question - by Etolas - 01.03.2015, 12:21

Forum Jump:


Users browsing this thread: 1 Guest(s)