Pickup SPAM - 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: Pickup SPAM (
/showthread.php?tid=423359)
Pickup SPAM -
Albania - 17.03.2013
Hello,
Before I start I want to apologize for my English.
So I have a little problem with pickup if I go on my pickup it starts spamming sent client message it looks like this :
Here is my code :
Pickups :
Код:
FBIInsidePickup = CreatePickup(1239,1,246.3956,87.5255,1003.6406,0);
FBIRoofPickup = CreatePickup(1239,1,-1750.0658,980.9041,95.8510,0);
FBIGaragePickup = CreatePickup(1239,1,-1716.3550,1018.1495,17.5859,0);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == FBIInsidePickup || pickupid == FBIRoofPickup || pickupid == FBIGaragePickup)
{
SendClientMessage(playerid,COLOR_DODGERBLUE,"Pour utiliser l'ascenseur du FBI tapez /monter et /descendre.");
return 1;
}
return 1;
}
Please Help me !
Re: Pickup SPAM -
kamzaf - 17.03.2013
Hm there seems to be nothing wrong with that code, the only thing is OnPlayerPickUpPickup is called every second, so therefore you will recieve that message every second if the player stays on that pickup. just a normal samp thing.
Re: Pickup SPAM -
Albania - 17.03.2013
No this is not true because I took another Gamemode the same gameplay and there it dont spam ...
Re: Pickup SPAM -
Jstylezzz - 17.03.2013
That's because they probably added a variable so the message is not displayed after the last time of display.
for example:
pawn Код:
if(pickupid == somepickup && showedmessage[playerid] == 0)
{
//show message
showedmessage[playerid] = 1;
}
Then reset the variable to 0 after 10 seconds or so.
Re: Pickup SPAM -
Albania - 17.03.2013
FAIl
Re: Pickup SPAM -
Albania - 17.03.2013
Quote:
Originally Posted by Jari_Johnson*
That's because they probably added a variable so the message is not displayed after the last time of display.
for example:
pawn Код:
if(pickupid == somepickup && showedmessage[playerid] == 0) { //show message showedmessage[playerid] = 1; }
Then reset the variable to 0 after 10 seconds or so.
|
How can i reset the variable afther 10 sec ? pls and thx it works ! <3
Re: Pickup SPAM -
Jstylezzz - 17.03.2013
Not sure if you totally solved it, but if not, check the following code.
Use SetTimerEx to set a timer with the playerid, like
pawn Код:
SetTimerEx("Resetvar",10000,0,"i",playerid);
forward Resetvar(playerid);
public Resetvar(playerid)
{
showedmessage[playerid] = 0;
}
Re: Pickup SPAM -
Albania - 17.03.2013
Quote:
Originally Posted by Jari_Johnson*
Not sure if you totally solved it, but if not, check the following code.
Use SetTimerEx to set a timer with the playerid, like
pawn Код:
SetTimerEx("Resetvar",10000,0,"i",playerid); forward Resetvar(playerid); public Resetvar(playerid) { showedmessage[playerid] = 0; }
|
THX i love you <3 !
Re: Pickup SPAM -
stabker - 17.03.2013
Quote:
Originally Posted by Jari_Johnson*
Not sure if you totally solved it, but if not, check the following code.
Use SetTimerEx to set a timer with the playerid, like
pawn Код:
SetTimerEx("Resetvar",10000,0,"i",playerid); forward Resetvar(playerid); public Resetvar(playerid) { showedmessage[playerid] = 0; }
|
I do not recommend doing that! Will be much faster and better:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == FBIInsidePickup || pickupid == FBIRoofPickup || pickupid == FBIGaragePickup)
{
new rtime = gettime();
if(GetPVarInt(playerid, "FBIPickupMinSec") < rtime)
{
SetPVarInt(playerid, "FBIPickupMinSec", rtime + 10); //you can replace 10 for another time in seconds
SendClientMessage(playerid,COLOR_DODGERBLUE,"Pour utiliser l'ascenseur du FBI tapez /monter et /descendre.");
return 1;
}
}
return 1;
}
than timer