SA-MP Forums Archive
[Ajuda] Problema com OnStateChange - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Problema com OnStateChange (/showthread.php?tid=289287)



[Ajuda] Problema com OnStateChange - cotonete - 10.10.2011

alguem poderia me explicar oque ta errado nesse cуdigo?
Код:
	if(oldstate == PLAYER_STATE_ONFOOT || newstate == PLAYER_STATE_ONFOOT )
	{
	if(arrayPlayer[playerid][Pinderby] == 1)
	{

  			new vehicleid = GetPlayerVehicleID(playerid);
			for(new z = 0; z < MAX_PLAYERS; ++z)
			{
				if(vehicleid == derbycar[z])
				{
				    new string[128];
				    format(string, sizeof(string), "'%s'(%d) foi desclassificado do Derby .", pNome(z),z);
				    SendClientMessageToAll(0xe045ffff,string);
				    arrayPlayer[z][Pinderby] = 0;
				    randomSpawn(z);
				    RemovePlayerFromDerby(z);
				}
			}
		}
	}
ele tinha que verificar se o jogador esta no derby, se saiu do carro ou o carro explodiu executar as coisas abaixo @_@


Re: [Ajuda] Problema com OnStateChange - Shelby - 10.10.2011

pawn Код:
if(arrayPlayer[playerid][Pinderby] == 1)
{// ... ^ checando se estб no derby.
    if(newstate == PLAYER_STATE_ONFOOT || newstate == PLAYER_STATE_WASTED || newstate == PLAYER_STATE_EXIT_VEHICLE || newstate == PLAYER_STATE_SPAWNED)
    {// ... ^ checando estado.
        new vehicleid = GetPlayerVehicleID(playerid);
        for(new z = 0; z < MAX_PLAYERS; ++z)
        {// ... /\ nгo entendi \/ ... (Nгo seria MAX_VEHICLES?)
            if(vehicleid == derbycar[z])
            {
                new string[128];
                format(string, sizeof(string), "'%s'(%d) foi desclassificado do Derby .", pNome(z),z);// Deve ser playerid!
                SendClientMessageToAll(0xe045ffff,string);
                arrayPlayer[z][Pinderby] = 0;// Deve ser playerid!
                randomSpawn(z);// Deve ser playerid!
                RemovePlayerFromDerby(z);// Deve ser playerid!
            }
        }
    }
}