PHP код:
if(!strcmp(cmdtext, "/putgun", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, LIGHTRED, "* You need to login first!");
return 1;
}
if(PlayerInfo2[Hospitalized][playerid] > 0)
{
SendClientMessage(playerid, LIGHTRED, "* Cannot do this right now!");
return 1;
}
if(PlayerInfo2[ReduceTime][playerid] > 0)
{
format(string, sizeof(string), "* You need to wait %d seconds to type this command.", PlayerInfo2[ReduceTime][playerid]);
SendClientMessage(playerid, LIGHTRED, string);
}
if(GetPlayerPing(playerid) >= 700)
{
SendClientMessage(playerid, GREY, "Your ping is too high to do this command.");
return 1;
}
if(PlayerInfo2[ReduceTime][playerid] > 0)
{
format(string, sizeof(string), " Please wait %d seconds to do this command.", PlayerInfo2[ReduceTime][playerid]);
SendClientMessage(playerid, GREY, string);
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, WHITE, "USAGE: /putgun [Slot]");
SendClientMessage(playerid, WHITE, "Hint: Check /weapons (/weps) to see all used and unused slots.");
return 1;
}
new level;
level = strval(tmp);
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
RemovePlayerWeaponEx(playerid, gunID);
PlayerInfo[playerid][pInvWeapon][level] = gunID;
PlayerInfo[playerid][pInvAmmo][level] = gunAmmo;
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "You put %s in your inventory.", gunname);
SendClientMessage(playerid, GREY, string);
PlayerInfo2[ReduceTime][playerid] = 2;
return 1;
}
else
{
SendClientMessage(playerid, GREY, "You don't have a gun to put in!");
return 1;
}
}
return 1;
}