Detective /Track
#1

Iam having a bunch of problems with this command, i can use it once, if iam the first person detective to connect the server, but if some other detective tryes to use it, it places a checkpoint forever!...

any ideas, on how to fix it

Код:
forward detecttimer(playerid);

CMD:localizar(playerid, params[])
{
	if (GetPVarInt(playerid, "PVARemprego") == 402)
	{
	    if ((GetPlayerSkin(playerid)) == 272)
	    {
		    if(isnull(params))
			{
				SendClientMessage(playerid, -1, "[{FFFF99}Emprego{FFFFFF}]: /localizar [ID]");
			}
			else
			{
			    if ((GetPVarInt(playerid, "PVARDetect_timer")) == 0)
			    {
			        new player;
				    player = strval(params);
				    
			        if ((IsPlayerConnected(player)) == true)
			        {
				 		new playername[128];
					    new Float:XX1, Float:YY1, Float:ZZ1;
				        GetPlayerPos(player, XX1, YY1, ZZ1);
				        GetPlayerName(player, playername, sizeof(playername));

				        SetPlayerCheckpoint(playerid, XX1, YY1, ZZ1, 3.0);
						format(playername, sizeof(playername), "[{FFFF99}Emprego{FFFFFF}]: Tentaste localizar {99FF00}%s{FFFFFF}", playername);
						SetTimer("detecttimer", 5000, 0);
						SetPVarInt(playerid, "PVARDetect_timer", 1);
						SendClientMessage(playerid, -1, playername);
					}
					else
					{
						SendClientMessage(playerid, -1,"[{FFFF99}Emprego{FFFFFF}]: Esse jogador nгo estб conectado!");
					}
				}
				else
				{
					SendClientMessage(playerid, -1, "[{FFFF99}Emprego{FFFFFF}]: Tens que esperar 5 segundos para utilizar este comando outra vez!");
				}
	        }
	    }
	    else
	    {
			SendClientMessage(playerid, -1, "[{FFFF99}Emprego{FFFFFF}]: Nгo tens o equipamento de detective! Vai б {0000FF}PSP{FFFFFF} equipar-te!");
		}
	}
	else
	{
		SendClientMessage(playerid, -1, "[{FFFF99}Emprego{FFFFFF}]: Nгo йs um [{FFFF99}Detective{FFFFFF}]");
	}
	return 1;
}
public detecttimer(playerid)
{
    DisablePlayerCheckpoint(playerid);
	SetPVarInt(playerid, "PVARDetect_timer", 0);
	return 1;
}
Any advice on how to improve my programing, some tutorial i should take... Always welcome!!


Best regards Sagoza
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)