14.07.2010, 07:18
Hello, i have a porblem on my teleport command:
Example: i used this command and spam timer (tp2) has started for me (im in tp[playerid]) 60 seconds, after 20 seconds another one used the same command. Now, i have 40 secs spam time, other player has 60 secs. After my spam time finishes, other one's spam time finishes, too. Because we are both in tp[playerid] (spam time).
I want to fix it with settimerex, but i have no information abt it (checked wiki's one, but nothing). It must be a personal timer, can some1 help ?
Код:
dcmd_tp(playerid,params[]) { if(!strlen(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /tp [playerid]"); new player1, string[128], string2[128]; if(!IsNumeric(params)) player1 = ReturnPlayerID(params); else player1 = strval(params); if(tp[playerid]==1) return SendClientMessage(playerid,COLOR_RED, "You need to wait a minute to teleport a player again."); new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1)); if(GetPlayerState(playerid) == 2) { if(GetPlayerInterior(player1)==0) { SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z); SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1)); SetPlayerPos(playerid,x+2,y,z); format(string,sizeof(string),"You have car-teleported to \"%s\"", pName(player1)); SendClientMessage(playerid,COLOR_YELLOW,string); format(string,sizeof(string),"\"%s\" has car-teleported you!", pName(playerid)); SendClientMessage(player1,COLOR_YELLOW,string); tp[playerid] = 1; SetTimer("tp2",60000,0); } else { SetPlayerInterior(playerid,GetPlayerInterior(player1)); SetPlayerPos(playerid,x+2,y,z); format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1)); SendClientMessage(playerid,COLOR_YELLOW,string); format(string2,sizeof(string2),"\"%s\" has teleported you!", pName(playerid)); SendClientMessage(player1,COLOR_YELLOW,string2); tp[playerid] = 1; SetTimer("tp2",60000,0); } } else { SetPlayerInterior(playerid,GetPlayerInterior(player1)); SetPlayerPos(playerid,x+2,y,z); format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1)); SendClientMessage(playerid,COLOR_YELLOW,string); format(string2,sizeof(string2),"\"%s\" has teleported you!", pName(playerid)); SendClientMessage(player1,COLOR_YELLOW,string2); tp[playerid] = 1; SetTimer("tp2",60000,0); } return 1; } public tp2() { for(new i = 0; i < MAX_PLAYERS; i++) if(!IsPlayerConnected(i)) continue; else if(tp[i] == 1) tp [i] = 0; return 1; }
I want to fix it with settimerex, but i have no information abt it (checked wiki's one, but nothing). It must be a personal timer, can some1 help ?