Pickup SPAM
#1

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 !
Reply
#2

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.
Reply
#3

No this is not true because I took another Gamemode the same gameplay and there it dont spam ...
Reply
#4

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.
Reply
#5

FAIl
Reply
#6

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
Reply
#7

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;
}
Reply
#8

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 !
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)