[Ajuda] Verificaзoes
#1

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 ) ;
        }
Reply
#2

mCarro[pid][Dono] й uma string

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

https://sampwiki.blast.hk/wiki/Strcmp
Reply
#3

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);
			}

}
Reply
#4

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);
        }
Reply
#5

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
}
Reply
#6

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);

Reply
#7

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
Reply
#8

Usa na callback OnPlayerEnterVehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)