[HELP] Set a player in a place for a time
#1

Well I need to know how to put a player in a place for a certain time and then set him to other place after that time


EX:

the player does a command /fly

it teleports the player to an interior for 10 seconds

it teleports the player to other place after those 10 seconds
Reply
#2

Use timers

EDIT: Example:
pawn Код:
//on top
new gFlyTimer;
pawn Код:
//timer function
forward FlyTimer(playerid);
public FlyTimer(playerid)
{
     SetPlayerPos( playerid, 0.0, 0.0, 0.0 ); //This is where you will teleport AFTER 10 seconds
     //SetPlayerInterior( ... );
}
pawn Код:
//command
if( !strcmp( cmdtext, "/fly", true ))
{
    SetPlayerPos( playerid, 0.0, 0.0, 0.0 ); //This is where you go when typing the command
    //SetPlayerInterior( ... );
    gFlyTimer = SetTimerEx( "FlyTimer", 1000, false, "i", playerid );
    return true;
}
Reply
#3

I dont know nothing about timers... can you help with a simple one?
Reply
#4

Look at my example.
Reply
#5

Ok but I want the command to be used in a place

EX: There's an icon that when you get near it it gives you a gametext for player saying /fly, BUT /fly can only be used in that place

How do i do it? X_x
Reply
#6

https://sampwiki.blast.hk/wiki/Areacheck
Reply
#7

As Claude linked; use areachecks and pickups (if you don't want an icon, pickups is unecaserry)

EDIT: Btw, for areachecks, I recommend using IsPlayerInRangeOfPoint.
Reply
#8

Nevermind,I'll just use

if (PlayerToPoint(2.0, playerid,x,y.z))
Reply
#9

IsPlayerInRangeOfPoint is exactly the same as PlayerToPoint, and IsPlayerInRangeOfPoint is already implemented..
Reply
#10

So is PlayerToPoint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)