pawn Код:
if(!strcmp(cmdtext, "/putgun", true)) // By LordMan
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You need to login first !");
return 1;
}
if(ReduceTime[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "** You need to wait 3 seconds before using this command again !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /putgun [slot]");
return 1;
}
new slot;
slot = strlen(tmp);
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
if(slot == 1)
{
if(PlayerInfo[playerid][pInvWeapon] != 0 || PlayerInfo[playerid][pInvAmmo] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 1!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon] = gunID;
PlayerInfo[playerid][pInvAmmo] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your slot 1.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 2)
{
if(PlayerInfo[playerid][pInvWeapon2] != 0 || PlayerInfo[playerid][pInvAmmo2] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 2!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon2] = gunID;
PlayerInfo[playerid][pInvAmmo2] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 2.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 3)
{
if(PlayerInfo[playerid][pInvWeapon3] != 0 || PlayerInfo[playerid][pInvAmmo3] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 3!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon3] = gunID;
PlayerInfo[playerid][pInvAmmo3] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 3.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 4)
{
if(PlayerInfo[playerid][pInvWeapon4] != 0 || PlayerInfo[playerid][pInvAmmo4] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 4!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon4] = gunID;
PlayerInfo[playerid][pInvAmmo4] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 4.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 5)
{
if(PlayerInfo[playerid][pInvWeapon5] != 0 || PlayerInfo[playerid][pInvAmmo5] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 5!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon5] = gunID;
PlayerInfo[playerid][pInvAmmo5] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 5.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 6)
{
if(PlayerInfo[playerid][pInvWeapon6] != 0 || PlayerInfo[playerid][pInvAmmo6] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 6!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon6] = gunID;
PlayerInfo[playerid][pInvAmmo6] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your slot 6.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 7)
{
if(PlayerInfo[playerid][pInvWeapon7] != 0 || PlayerInfo[playerid][pInvAmmo7] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 7!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon7] = gunID;
PlayerInfo[playerid][pInvAmmo7] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 7.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 8)
{
if(PlayerInfo[playerid][pInvWeapon8] != 0 || PlayerInfo[playerid][pInvAmmo8] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 8!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon8] = gunID;
PlayerInfo[playerid][pInvAmmo8] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your slot 8.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 9)
{
if(PlayerInfo[playerid][pInvWeapon9] != 0 || PlayerInfo[playerid][pInvAmmo9] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 9!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon9] = gunID;
PlayerInfo[playerid][pInvAmmo9] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 9.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 10)
{
if(PlayerInfo[playerid][pInvWeapon10] != 0 || PlayerInfo[playerid][pInvAmmo10] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 10!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon10] = gunID;
PlayerInfo[playerid][pInvAmmo10] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 10.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 11)
{
if(PlayerInfo[playerid][pInvWeapon11] != 0 || PlayerInfo[playerid][pInvAmmo11] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have Already placed something at your Slot 11!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon11] = gunID;
PlayerInfo[playerid][pInvAmmo11] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 11.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(slot == 12)
{
if(PlayerInfo[playerid][pInvWeapon12] != 0 || PlayerInfo[playerid][pInvAmmo12] != 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You have placed something at your Slot 12!");
return 1;
}
ReduceTime[playerid] = 1;
SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
PlayerInfo[playerid][pInvWeapon12] = gunID;
PlayerInfo[playerid][pInvAmmo12] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetPlayerName(playerid, sendername, sizeof(sendername));
new gunname[100];
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 12.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "** You don't have a gun to put in ! ");
return 1;
}
}
return 1;
}
That is the Command, But when i do /putgun XX , Nothing Happens...
Could anyone Help me and tell me what is wrong Please? I Started to script a few weeks ago and i'm familiarizing with the Codes :=)