Add ...
enum Teleports
{
Float:FL1,
Float:FL2,
Float:FL3,
}
Tele[MAX_PLAYERS][Teleports];
Teleporting[MAX_PLAYERS];
Now Add Command..
else if (strcmp(cmd, "gotoloc", 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_GREEN,"USAGE: /c gotoloc [Name]");
else {
new splitx[3][128], szMsg[256];
if(!IsLocationExist(tmp)) {
format(szMsg,sizeof(szMsg),"Location:[ %s ] does not exist.",tmp);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
return 1;
}
split(dini_Get("/SavedLocations/Locations.ini",tmp), splitx, ' ');
SetTimer("GotolocTime", 5000, 0);
Teleporting[playerid] = 1;
format(szMsg,sizeof(szMsg),"Teleporting to location:[ %s ]",tmp);
SendClientMessage(playerid,COLOR_GREEN,szMsg);
Tele[playerid][FL1] = floatstr(splitx[0]);
Tele[playerid][FL2] = floatstr(splitx[1]);
Tele[playerid][FL3] = floatstr(splitx[2]);
TogglePlayerControllable(playerid, 0);
}
return 1;
}
Timer
forward GotolocTime();
public GotolocTime() {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(Teleporting[i] == 1) {
SetPlayerPos(i,Tele[i][FL1],Tele[i][FL2],Tele[i][FL3],0,0);
GameTextForPlayer(i,"Teleported");
Teleporting[i] = 0;
TogglePlayerControllable(i, 1);
}
}
return 1;
}
CREDITS : ME