Author Topic: !goto 5 secs  (Read 3237 times)

0 Members and 1 Guest are viewing this topic.

Offline Synx

  • Street Thug
  • *
  • Posts: 27
    • View Profile
!goto 5 secs
« on: May 18, 2011, 02:22:32 pm »
how to create when type !goto, im freeze and 5 seconds will pass i will teleport?

Offline Castagna

  • VC:MP Beta Tester
  • Made Man
  • *
  • Posts: 129
  • Global Moderator
    • View Profile
Re: !goto 5 secs
« Reply #1 on: May 18, 2011, 06:57:35 pm »
pwn or squirrel ?
Castagna - EA Founder


Offline Synx

  • Street Thug
  • *
  • Posts: 27
    • View Profile
Re: !goto 5 secs
« Reply #2 on: May 18, 2011, 08:12:59 pm »
Pawn - Pwn... :D

Offline Castagna

  • VC:MP Beta Tester
  • Made Man
  • *
  • Posts: 129
  • Global Moderator
    • View Profile
Re: !goto 5 secs
« Reply #3 on: May 18, 2011, 09:50:15 pm »
Just use a timmer .. I will give you an example..

[pawn]
   if (strcmp(cmd, "!goto", true) == 0) {
      tmp = strtok(cmdtext, idx);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if(!strlen(tmp)) SendClientMessage(playerid, COLOR_GREY, "Usage: !goto [Nick/ID]");
      else {
          new plr = FindPlayerIDFromString(tmp);
          if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_GREEN,"Error: Unknown player");
          else if (PlayerInfo[plr][NoGoto] == 1) SendClientMessagef(playerid,COLOR_GREEN, "%s has goto Disabled.",strval(gPlayers[plr]));
          else if (!IsPlayerSpawned(plr)) SendClientMessagef(playerid,COLOR_GREEN, "Error: %s does not spawned!",gPlayers[plr]);
          else {
            GetPlayerPos(plr,x,y,z);
            SetPlayerPos(playerid,x,y + 1.0,z,0,0);
            format(szMsg,sizeof(szMsg),"Teleporting:[ %s ] to:[ %s ]",gPlayers[playerid],gPlayers[plr]);
            SendClientMessageToAll(COLOR_GREEN, szMsg);
                                                                SetTimer("EVADE",5000,1);
                                                                TogglePlayerControllable(playerid,0);
                                                                GameTextForPlayer(playerid,"~w~teleporting..");
                                                                SendClientMessage(playerid,COLOR_JOIN,"Please wait 5 seconds to teleport for no evading.");
         }
      }
      return 1;[/pawn]

Them on PlayerFunction ...
[pawn]
public EVADE()
{
SendClientMessageToAll(COLOR_GREEN,"You has been teleported!");
TogglePlayerControllable(playerid,1);
}[/pawn]
Castagna - EA Founder


Offline Synx

  • Street Thug
  • *
  • Posts: 27
    • View Profile
Re: !goto 5 secs
« Reply #4 on: May 18, 2011, 10:00:08 pm »
TNX,

-=LOCK=-