Put and take gun convert to ZCMD! -
MrSnapp - 18.09.2012
Please help me convert these to ZCMD and yes I know they are from Ravens RP but its a nice feature. Thanks. Will give rep.
Код:
if(!strcmp(cmd, "/putgun", true)) // Modified by CuervO_NegrO
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You need to login first !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /putgun [slot]");
return 1;
}
if(PlayerInfo[playerid][pAdminDuty] >= 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "** Silly Admin, you Wont Cheat your Weapons!");
return 1;
}
if(PlayerInfo[playerid][pDuty] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "** Do not Cheat Your Weapons!!!");
return 1;
}
new slot;
slot = strval(tmp);
new gunname[100];
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
new Float:Health;
GetPlayerHealth(playerid, Health);
if(Health <= 15) return SendClientMessage(playerid, COLOR_GREY,"You cannot use This command with such low HP");
if(gunID != 0 && gunAmmo != 0)
{
if(slot < 1||slot > 12)
{
SendClientMessage(playerid, COLOR_GREY, "** Slot can't go Below 1 and Above 12!");
return 1;
}
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;
}
PlayerInfo[playerid][pInvWeapon] = gunID;
PlayerInfo[playerid][pInvAmmo] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your slot 1.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
}
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;
}
PlayerInfo[playerid][pInvWeapon2] = gunID;
PlayerInfo[playerid][pInvAmmo2] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 2.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
}
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;
}
PlayerInfo[playerid][pInvWeapon3] = gunID;
PlayerInfo[playerid][pInvAmmo3] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 3.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
}
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;
}
PlayerInfo[playerid][pInvWeapon4] = gunID;
PlayerInfo[playerid][pInvAmmo4] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 4.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
}
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;
}
PlayerInfo[playerid][pInvWeapon5] = gunID;
PlayerInfo[playerid][pInvAmmo5] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your Slot 5.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
}
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;
}
PlayerInfo[playerid][pInvWeapon6] = gunID;
PlayerInfo[playerid][pInvAmmo6] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
GetWeaponName(gunID, gunname, sizeof(gunname));
format(string, sizeof(string), "** You put %s in your slot 6.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
}
format(string, sizeof(string), "* %s Puts his/her %s in his/her Bag.", sendername, gunname);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /putgun %d (%s)",d,m,y,h,mi,s,sendername, slot, gunname);
CommandLog(string);
}
}
return 1;
}
Код:
if(!strcmp(cmd, "/takegun", true)) // Modified by CuervO_NegrO
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You need to login first !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /takegun [slot]");
return 1;
}
if(PlayerInfo[playerid][pAdminDuty] >= 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "** This comand is Disable while on Admin Duty");
return 1;
}
new slot;
new gunname[100];
slot = strval(tmp);
if(slot < 1||slot > 12) { SendClientMessage(playerid, COLOR_GREY, "** Slot can't go Below 1 and Above 12!"); return 1; }
if(slot == 1)
{
if(PlayerInfo[playerid][pInvWeapon] == 0 && PlayerInfo[playerid][pInvAmmo] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You haven't placed any gun at your Slot 1!");
return 1;
}
GetWeaponName(PlayerInfo[playerid][pInvWeapon], gunname, sizeof(gunname));
SafeGivePlayerWeapon(playerid, PlayerInfo[playerid][pInvWeapon], PlayerInfo[playerid][pInvAmmo]);
format(string, sizeof(string), "** You took %s from your inventory.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pInvWeapon] = 0;
PlayerInfo[playerid][pInvAmmo] = 0;
}
if(slot == 2)
{
if(PlayerInfo[playerid][pInvWeapon2] == 0 && PlayerInfo[playerid][pInvAmmo2] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You haven't placed any gun at your Slot 2!");
return 1;
}
GetWeaponName(PlayerInfo[playerid][pInvWeapon2], gunname, sizeof(gunname));
SafeGivePlayerWeapon(playerid, PlayerInfo[playerid][pInvWeapon2], PlayerInfo[playerid][pInvAmmo2]);
format(string, sizeof(string), "** You took %s from your Slot 2.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pInvWeapon2] = 0;
PlayerInfo[playerid][pInvAmmo2] = 0;
}
if(slot == 3)
{
if(PlayerInfo[playerid][pInvWeapon3] == 0 && PlayerInfo[playerid][pInvAmmo3] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You haven't placed any gun at your Slot 3!");
return 1;
}
GetWeaponName(PlayerInfo[playerid][pInvWeapon3], gunname, sizeof(gunname));
SafeGivePlayerWeapon(playerid, PlayerInfo[playerid][pInvWeapon3], PlayerInfo[playerid][pInvAmmo3]);
format(string, sizeof(string), "** You took %s from your Slot 3.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pInvWeapon3] = 0;
PlayerInfo[playerid][pInvAmmo3] = 0;
}
if(slot == 4)
{
if(PlayerInfo[playerid][pInvWeapon4] == 0 && PlayerInfo[playerid][pInvAmmo4] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You haven't placed any gun at your Slot 4!");
return 1;
}
GetWeaponName(PlayerInfo[playerid][pInvWeapon4], gunname, sizeof(gunname));
SafeGivePlayerWeapon(playerid, PlayerInfo[playerid][pInvWeapon4], PlayerInfo[playerid][pInvAmmo4]);
format(string, sizeof(string), "** You took %s from your Slot 4.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pInvWeapon4] = 0;
PlayerInfo[playerid][pInvAmmo4] = 0;
}
if(slot == 5)
{
if(PlayerInfo[playerid][pInvWeapon5] == 0 && PlayerInfo[playerid][pInvAmmo5] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You haven't placed any gun at your Slot 5!");
return 1;
}
GetWeaponName(PlayerInfo[playerid][pInvWeapon5], gunname, sizeof(gunname));
SafeGivePlayerWeapon(playerid, PlayerInfo[playerid][pInvWeapon5], PlayerInfo[playerid][pInvAmmo5]);
format(string, sizeof(string), "** You took %s from your Slot 5.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pInvWeapon5] = 0;
PlayerInfo[playerid][pInvAmmo5] = 0;
}
if(slot == 6)
{
if(PlayerInfo[playerid][pInvWeapon6] == 0 && PlayerInfo[playerid][pInvAmmo6] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "** You haven't placed any gun at your Slot 6!");
return 1;
}
GetWeaponName(PlayerInfo[playerid][pInvWeapon6], gunname, sizeof(gunname));
SafeGivePlayerWeapon(playerid, PlayerInfo[playerid][pInvWeapon6], PlayerInfo[playerid][pInvAmmo6]);
format(string, sizeof(string), "** You took %s from your Slot 6.", gunname);
SendClientMessage(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pInvWeapon6] = 0;
PlayerInfo[playerid][pInvAmmo6] = 0;
}
format(string, sizeof(string), "* %s Takes out a %s From a Bag at his/her Back.", sendername, gunname);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /takegun %d (%s)",d,m,y,h,mi,s,sendername, slot, gunname);
CommandLog(string);
}
return 1;
}
Re: Put and take gun convert to ZCMD! -
Audiophr3ak - 18.09.2012
Why does everyone makes that "/putgun" system instead of saving all weapons?
Re: Put and take gun convert to ZCMD! -
MarkoN - 18.09.2012
is it so hard to change the header ?
pawn Код:
if(!strcmp(cmd, "/putgun", true)) // Modified by CuervO_NegrO
{
to
pawn Код:
CMD:putgun(playerid, params[])
{
Re: Put and take gun convert to ZCMD! -
clarencecuzz - 18.09.2012
That would be changing his command processor, not 'changing the header'...
but yes, changing to a command processor like ZCMD is recommended in this case, as you can use it in synchronisation with Y_INI which is a very simple system to use.
Re: Put and take gun convert to ZCMD! -
MrSnapp - 02.12.2012
Thanks. What else would I need to change?