Help in scripting.. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help in scripting.. (
/showthread.php?tid=567257)
Help in scripting.. -
fuckingcruse - 12.03.2015
I have made a cmd for my server /sniperdm and /minigundm
When a player type /minigundm he gets minigun weapon and again if he types /sniperdm he have sniper gun + minigun weapon..
I want you guys to help me by saying how to script something like when they type /minigundm and then /sniperdm it must say type /leave first and when they type /minigundm other all weapons must be disarmed..
Sorry for disturbing .. i am a beginner for scripting .. I request you to kindly help me
Re: Help in scripting.. -
ATGOggy - 12.03.2015
Just use ResetPlayerWeapons first and then GivePlayerWeapon to disarm all other weapons when a player types /sniperdm or /minigundm.
Re: Help in scripting.. -
CalvinC - 12.03.2015
Use a boolean array to check, first declare a global one in the top of your script:
pawn Код:
new bool:MinigunDM[MAX_PLAYERS];
A boolean can have 2 values, true/false (set to false by default), so in your command, set it to true.
pawn Код:
CMD:minigundm(playerid, params[])
{
if(MinigunDM[playerid]) return SendClientMessage(playerid, -1, "Type /leave to leave minigun DM");
// If MinigunDM is set to true, stop the rest of the cmd using "return", and send the player a message
MinigunDM[playerid] = true;
// If the command hasn't been stopped, it will set MinigunDM to true
// Other codes
}
And then set it to false in your /leave command if it's set to true.
Re: Help in scripting.. -
fuckingcruse - 12.03.2015
Calvin They one for Disarming?
Re: Help in scripting.. -
ATGOggy - 12.03.2015
Quote:
Originally Posted by ATGOggy
Just use ResetPlayerWeapons first and then GivePlayerWeapon to disarm all other weapons when a player types /sniperdm or /minigundm.
|
What I meant was this:
PHP код:
CMD:minigundm(playerid, params[])
{
ResetPlayerWeapons(playerid);
GivePlayerWeapons(playerid, WEAPON_MINIGUN, ammo);
//remaining code
}
and
CMD:sniperdm(playerid, params[])
{
ResetPlayerWeapons(playerid);
GivePlayerWeapons(playerid, WEAPON_SNIPER, ammo);
//remaining code
}
This will reset all weapons when a player joins a dm.
Re: Help in scripting.. -
CalvinC - 12.03.2015
Quote:
Originally Posted by fuckingcruse
Calvin They one for Disarming?
|
ATOggy told you how to disarm a player.
Re: Help in scripting.. -
fuckingcruse - 12.03.2015
can i get a clear information about the /leave CMD?