06.08.2013, 16:54
Ok, So i'm making a roleplay command that let's the player give his weapon to an other player, It won't go passed a certain line tho here is what I have.
and it won't do the code passed this line
pawn Код:
COMMAND:give(playerid, params[])
{
new type[128],string[128],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
if(sscanf(params, "s[128]", type)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /give [weapon / weed / crack]");
else
{
new id;
if(RpPlayerInfo[playerid][pMute] == 1) return SendClientMessage(playerid,COLOR_RED,"WARNING: You are currently muted.");
if(strcmp(type, "weapon", true) == 0)
{
if(!sscanf(params, "i", id)) // this is the line it won't go passed.
{
if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't give a gun to your self!");
if(IsPlayerConnected(id))
{
new gun,gunname[32],ammo;
gun = GetPlayerWeapon(playerid);
GetWeaponName(gun,gunname,sizeof(gunname));
ammo = GetPlayerAmmo(playerid);
sendername = GetName(playerid);
giveplayer = GetName(id);
GiveNameSpace(sendername);
GiveNameSpace(giveplayer);
GivePlayerWeapon(id,gun,ammo);
format(string, sizeof(string), "*%s gives his %s to %s.", sendername,gunname,giveplayer);
ProxDetector(30, id, string, COLOR_PURPLE);
RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
SaveStats(id);
SaveStats(playerid);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected!");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /give weapon [playerid]");
}
return 1;
}
return 1;
}
pawn Код:
if(!sscanf(params, "i", id)) // this is the line it won't go passed.