SA-MP Forums Archive
I dont want people to spam some commands - 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: I dont want people to spam some commands (/showthread.php?tid=102166)



I dont want people to spam some commands - MartinDaniel - 13.10.2009

Well i did /nrg command to spawn you NRG-500, but people are spamming it....Is there any idea so it cant be spammed, and doesnt respawn again


Re: I dont want people to spam some commands - shady91 - 13.10.2009

Quote:
Originally Posted by MartinDaniel
Well i did /nrg command to spawn you NRG-500, but people are spamming it....Is there any idea so it cant be spammed, and doesnt respawn again
post your command and ill add it in for you.


Re: I dont want people to spam some commands - MartinDaniel - 13.10.2009

Here it is:

Код:
	if (strcmp("/nrg", cmdtext, true, 10) == 0)
	{
		new Float: X, Float: Y, Float: Z, Float: A;
		GetPlayerPos(playerid,X,Y,Z);
		GetPlayerFacingAngle(playerid,A);
		new car = CreateVehicle(522,X,Y,Z,A,-1,-1,120000);
		PutPlayerInVehicle(playerid,car,0);
		return 1;
	}



Re: I dont want people to spam some commands - shady91 - 13.10.2009

pawn Код:
new Spawned[MAX_PLAYERS];//global varible
pawn Код:
Spawned[playerid] = 0;// add under onplayerconnect
pawn Код:
if (strcmp("/nrg", cmdtext, true, 10) == 0)
{
if(Spawned[playerid] == 1)
{
SendClientMessage(playerid, yourcolor, " You already spawned a nrg500");
retrun 1;
}
        new Float: X, Float: Y, Float: Z, Float: A;
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,A);
        new car = CreateVehicle(522,X,Y,Z,A,-1,-1,120000);
        PutPlayerInVehicle(playerid,car,0);
             Spawned[playerid] = 1;
        return 1;
    }
not tested should work tho


Re: I dont want people to spam some commands - whooper - 13.10.2009

Should be return 1; not retrun 1;


Re: I dont want people to spam some commands - MartinDaniel - 13.10.2009

I got 4 errors:
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(163) : error 017: undefined symbol "Spawned"
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(163) : warning 215: expression has no effect
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(163) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(163) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(163) : fatal error 107: too many error messages on one line

Error line 163: Spawned[playerid] = 0;


Re: I dont want people to spam some commands - MartinDaniel - 14.10.2009

Hello guys, any idea ?


Sorry for the double post


Re: I dont want people to spam some commands - shady91 - 14.10.2009

did you add this at the top of your script new Spawned[MAX_PLAYERS];


Re: I dont want people to spam some commands - MartinDaniel - 14.10.2009

It works now, thanks



Re: I dont want people to spam some commands - shady91 - 14.10.2009

Quote:
Originally Posted by MartinDaniel
It works now, thanks
np any time