SA-MP Forums Archive
[Ajuda] Verificaзoes - 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] Verificaзoes (/showthread.php?tid=669628)



Verificaзoes - smith - 26.09.2019

Como verificar se o player e dono do carro ou removelo??
tentei dessa forma mais nao ta funcionando ele remove ate o dono
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate){
    new carro = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
 {

        if (mCarro[pid][Dono] == GetPlayerVehicleID(playerid))
        {
        new str[30];
        new owner[MAX_PLAYER_NAME];
        GetPlayerName(mCarro[pid][Dono], owner, sizeof(owner));
        format(str, sizeof(str), "Este(a) \"%s\" pertence a %s.", GetVehicleNameFromID(GetPlayerVehicleID(playerid)), owner);
        msg(pid , -1, str) ;
        }
        else{
        new str[30];
        new owner[MAX_PLAYER_NAME];
        GetPlayerName(mCarro[pid][Dono], owner, sizeof(owner));
        format (str, sizeof (str), "Veнculo de %s somente ele(a) pode dirigi-lo!" , mCarro[pid][Dono]);
        SendClientMessage (pid, -1 , str) ;
        PlayerPlaySound (pid , 1147 , 0.0 , 0.0 , 0.0) ;
        RemovePlayerFromVehicle ( pid ) ;
        }



Re: Verificaзoes - NWDMadara - 26.09.2019

mCarro[pid][Dono] й uma string

Vocк precisa comparб-la com o nome do player

https://sampwiki.blast.hk/wiki/Strcmp


Re: Verificaзoes - smith - 27.09.2019

to ate agora tentando intender pode explicar melho
Code:
if ( ! Strcmp (mCarro[pid][Dono], mCarro[pid][Dono] ) )
eu teria de criar um carro pra cada jogador?
tipo fazer uma string com algumas celulas para fazer tipo
Code:
if(carro == Dono[1]){
if(mCarro[pid][Dono] == Dono{
				msg(playerid, -1, "Voce esta em um carro pArticular);
			}
			else {
				msg(playerid, -1, "Tentando roubar neh Ladraozinho barato");
				RemovePlayerFromVehicle(playerid);
			}

}



Re: Verificaзoes - smith - 27.09.2019

tentei tbm n deu
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate){
new str[30];
    new dn[MAX_PLAYER_NAME];
    new dono = GetPlayerName(pid, dn, sizeof(dn));
   
    if(newstate == PLAYER_STATE_DRIVER)
 {
 
        if(dono == mCarro[pid][Dono])
        {
        format(str, sizeof(str), "%s Seu carro esta pronto para se locomover", dn);
        msg(pid, -1, str);
        }
        else
        {
        msg(playerid, -1, "Tentando roubar neh Ladraozinho barato");
        RemovePlayerFromVehicle(playerid);
        }



Re: Verificaзoes - NWDMadara - 27.09.2019

Puta que pariu kkkkkkk, vocк nгo lк o que a strcmp faz? Lб diz o que ela faz e como usб-lб.

new jogador[MAX_PLAYER_NAME];
GetPlayerName(playerid, jogador, MAX_PLAYER_NAME);

if(!strcmp(jogador, mCarro[pid][dono], false))
{
// SOu o dono
}


Re: Verificaзoes - MorteAmerica - 28.09.2019

PHP Code:
new NomeDoPlayer[MAX_PLAYER_NAME];
GetPlayerName(playeridNomeDoPlayersizeof(NomeDoPlayer));
if(!
strcmp(NomeDoPlayermCarro[pid][dono], true))
{
//Aqui й o que acontece caso a comparaзгo entre as variбveis for verdadeira(caso ele for o dono)
}
else
{
RemovePlayerFromVehicle(playerid);
//Aqui o oposto(caso nгo for o dono);




Re: Verificaзoes - smith - 30.09.2019

Quote:
Originally Posted by MorteAmerica
View Post
PHP Code:
new NomeDoPlayer[MAX_PLAYER_NAME];
GetPlayerName(playeridNomeDoPlayersizeof(NomeDoPlayer));
if(!
strcmp(NomeDoPlayermCarro[pid][dono], true))
{
//Aqui й o que acontece caso a comparaзгo entre as variбveis for verdadeira(caso ele for o dono)
}
else
{
RemovePlayerFromVehicle(playerid);
//Aqui o oposto(caso nгo for o dono);

tentei mais qualquer player pode usar o carro


Re: Verificaзoes - G4M30V3R - 30.09.2019

Usa na callback OnPlayerEnterVehicle