Simple question...
#1

I want to delay a message with a timer on player spawn

so i want to wait about 3 seconds after player spawns, then he recieves a message "welcome"

help me please
Reply
#2

Edit: Woops, sorry I misread.

Use SetTimerEx.
Reply
#3

I have... like this but it isn't working

Код:
SetTimerEx("WelcomeDelay", 10, true, "i", playerid);
		 SetPlayerPos(playerid, PVar[playerid][pLastX], PVar[playerid][pLastY], PVar[playerid][pLastZ]);
		 SetPlayerSkin(playerid,PVar[playerid][pDeaths]);
		 SendClientMessage(playerid,COLOR_GREEN, " Welcome");
Reply
#4

Alright, I made this just for example.

pawn Код:
public OnPlayerConnect(playerid)
{
    SetTimerEx("Wait"/*Name of the Function/Timer*/, 3000/*Time - 3sec*/, false/*It will not repeate*/,/*You're sending players ID as a parameter ->*/ "i", playerid);
    return 1;
}

forward Wait(playerid);
public Wait(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to my server!");
    return 1;
}
Reply
#5

G:\DOCUME~1\Admin\Desktop\SAMP\FILTER~1\COPYOF~1.P WN(187) : warning 202: number of arguments does not match definition
G:\DOCUME~1\Admin\Desktop\SAMP\FILTER~1\COPYOF~1.P WN(219) : error 029: invalid expression, assumed zero
G:\DOCUME~1\Admin\Desktop\SAMP\FILTER~1\COPYOF~1.P WN(219) : error 017: undefined symbol "Wait"
G:\DOCUME~1\Admin\Desktop\SAMP\FILTER~1\COPYOF~1.P WN(220) : error 029: invalid expression, assumed zero
G:\DOCUME~1\Admin\Desktop\SAMP\FILTER~1\COPYOF~1.P WN(220) : error 017: undefined symbol "Wait"

Код:
public OnPlayerSpawn(playerid)
{
	if(PVar[playerid][pLastX] == 0.0 && PVar[playerid][pLastY] == 0.0)
	{
		new
		    RPos = random(sizeof(RandSpawns));

		
		SetPlayerPos(playerid, RandSpawns[RPos][0], RandSpawns[RPos][1], RandSpawns[RPos][2]);
	}
	else
         {
    SetTimerEx("Wait"/*Name of the Function/Timer*/, 3000/*Time - 3sec*/, false/*It will not repeate*/,/*You're sending players ID as a parameter ->*/ "i", playerid);
    return 1;
}

	forward Wait(playerid);
	public Wait(playerid)
	{
    	SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to my server!");
    	return 1;
	}
		return 1;
}
Reply
#6

Wow! You messed up a lot of things.

+ You shouldn't forward/create new function in premaded one...

It should be like:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PVar[playerid][pLastX] == 0.0 && PVar[playerid][pLastY] == 0.0)
    {
        new RPos = random(sizeof(RandSpawns));
        SetPlayerPos(playerid, RandSpawns[RPos][0], RandSpawns[RPos][1], RandSpawns[RPos][2]);
    }
    else
    {
        SetTimerEx("Wait"/*Name of the Function/Timer*/, 3000/*Time - 3sec*/, false/*It will not repeate*/,/*You're sending players ID as a parameter ->*/ "i", playerid);
    }
    return 1;
}

forward Wait(playerid);
public Wait(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to my server!");
    return 1;
}
Reply
#7

Now it compiles, but the message doesn't show..... darn...
Reply
#8

Try using 'print' and see if the timer gets called. Also, check if your 'PVar[playerid][pLastX]' or 'PVar[playerid][pLastY]' is not 0.00.
Reply
#9

The Var's can't be 0 because it's the last know position of the player, i did printf, but nothing happened
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)