ResetWeapons - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ResetWeapons (
/showthread.php?tid=230609)
ResetWeapons -
SanAndreasVille - 23.02.2011
Hi
I want a script when i type /resetweapons then reset all weapons of every player on the server have everyone a script ?
Re: ResetWeapons -
Momo5000 - 23.02.2011
Put that in OnPlayerCommandText(playerid, cmdtext[])
Код:
if(!strcmp(cmdtext, "/resetweapons", false))
{
for(new i=0;i<MAX_PLAYERS;i++){
if(!IsPlayerConnected(i)) continue;
ResetPlayerWeapons(i);
SendClientMessage(i, 0xAAAAAAAA, "[Pirat] I took all weapons! ARHHH!");
}
return 1;
}
Re: ResetWeapons -
maramizo - 23.02.2011
Quote:
Originally Posted by Momo5000
Put that in OnPlayerCommandText(playerid, cmdtext[])
Код:
if(!strcmp(cmdtext, "/resetweapons", false))
{
ResetPlayerWeapons(playerid);
SendClientMessage(playerid, 0xAAAAAAAA, "[Pirat] I took you're weapons! ARHHH!");
return 1;
}
|
He said all player weapons, what you did would remove the player that enter'd the command's weapons.
Ok first add this at the top.
pawn Код:
#include <a_samp>
#include <foreach>
#include <zcmd>
And this outside of any publics
pawn Код:
CMD:resetweapons(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF3300, "You're not a server admin");
foreach (Player, i)
ResetPlayerWeapons(i);
return 1;
}
Re: ResetWeapons -
Momo5000 - 23.02.2011
Thanks, Edited.
Re: ResetWeapons -
alpha500delta - 23.02.2011
He means for every player, this is just for the player itsself. You can use this vor every player
This is when you use foreach + zcmd:
pawn Код:
CMD:resetweapons(playerid, params[])
{
foreach(Player, i)
ResetPlayerWeapons(i,);
SendClientMessageToAll(COLOR, "Damnit an admin took all yer weapons >:(");
return 1;
}
This is when you use strcmp and basic loop:
pawn Код:
if(strcmp(cmdtext, "/resetweapons", true) == 0)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ResetPlayerWeapons(i);
SendClientMessageToAll(COLOR, "Damnit an admin took all yer weapons >:(");
}
}
return 1;
}
Re: ResetWeapons -
maramizo - 23.02.2011
Quote:
Originally Posted by alpha500delta
He means for every player, this is just for the player itsself. You can use this vor every player
This is when you use foreach + zcmd:
pawn Код:
CMD:resetweapons(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF3300, "You're not a server administrator"); foreach(Player, i) ResetPlayerWeapons(i); SendClientMessageToAll(COLOR, "Damnit an admin took all yer weapons >:("); return 1; }
This is when you use strcmp and basic loop:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/resetweapons", true) == 0) { for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF3300, "You're not a server administrator"); ResetPlayerWeapons(i); SendClientMessageToAll(COLOR, "Damnit an admin took all yer weapons >:("); } } return 1; } return 0; }
|
Fixed*
Re: ResetWeapons -
SanAndreasVille - 23.02.2011
Thank You its WORK !
Re: ResetWeapons -
maramizo - 23.02.2011
No problem.
Re: ResetWeapons -
jejemonerz123 - 24.02.2011
Quote:
Originally Posted by Momo5000
Put that in OnPlayerCommandText(playerid, cmdtext[])
Код:
if(!strcmp(cmdtext, "/resetweapons", false))
{
for(new i=0;i<MAX_PLAYERS;i++){
if(!IsPlayerConnected(i)) continue;
ResetPlayerWeapons(i);
SendClientMessage(i, 0xAAAAAAAA, "[Pirat] I took all weapons! ARHHH!");
}
return 1;
}
|
nice