[Ajuda] Retirar Player do Veнculo
#1

Bom galera, eu fiz uma organizaзгo com seus devidos carros, e criei a funзгo de que se o player entrar em um carro da ORG e n pertencer a mesma, ele serб retirado do carro.. Nгo dб nenhum erro ao compilar, porйm in-Game quando entro no carro sem ser da ORG, nada acontece e posso andar normalmente com ele..

Cуdigo:

PHP код:
public OnPlayerUpdate(playerid)
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    if((
vehicleid >= GroveCars[0]) && (vehicleid <= GroveCars[7]))
    {
        if(
pDados[playerid][Organizacao] != GROVE)
        {
            
RemovePlayerFromVehicle(playerid);
        
SendClientMessage(playeridCOR_ERRO"Vocк nгo й da Groove Street !");
        }
    }
    return 
1;

Ja tentei alternar do OnPlayerUpdate para o OnPlayerEnterVehicle, mas msmo assim nгo funciona..

Alg ajuda por favor ? Obg.
Reply
#2

pawn Код:
new Grove[4]; // Nъmero dos carros+1

forward Grovecar(playerid);

// na public ongamemodeinit
Grove[0] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 0
Grove[1] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 1
Grove[2] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 2
Grove[3] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 3

// na OnPlayerStateChange

    if(newstate == PLAYER_STATE_DRIVER) Grovecar(playerid);

// e depois
public GroveCar(playerid)
{
    for(new c = 0; c <= 4; c++)
    {
        if(IsPlayerInVehicle(playerid, Grove[c]) && pDados[playerid][Grove] < 1)
        {
            SendClientMessage(playerid, COR_eRRO, "Vocк nгo й um Groove Los Santos");
            RemovePlayerFromVehicle(playerid);
            return 1;
        }
    }
    return 1;
}
Usa esse exemplo ai , ve se funfa
Reply
#3

Quote:
Originally Posted by FleXx_01
Посмотреть сообщение
pawn Код:
new Grove[4]; // Nъmero dos carros+1

forward Grovecar(playerid);

// na public ongamemodeinit
Grove[0] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 0
Grove[1] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 1
Grove[2] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 2
Grove[3] = CreateVehicle(modelo, X, Y, Z, Rotaзгo, Cor1, Cor2, RespawnDelay); //Veiculo numero 3

// na OnPlayerStateChange

    if(newstate == PLAYER_STATE_DRIVER) Grovecar(playerid);

// e depois
public GroveCar(playerid)
{
    for(new c = 0; c <= 4; c++)
    {
        if(IsPlayerInVehicle(playerid, Grove[c]) && pDados[playerid][Grove] < 1)
        {
            SendClientMessage(playerid, COR_eRRO, "Vocк nгo й um Groove Los Santos");
            RemovePlayerFromVehicle(playerid);
            return 1;
        }
    }
    return 1;
}
Usa esse exemplo ai , ve se funfa
Код:
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : error 012: invalid function call, not a valid address
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : warning 215: expression has no effect
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Linha:
PHP код:
if(newstate == PLAYER_STATE_DRIVERGroveCars(playerid); 
Complemento da linha :

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVERGroveCars(playerid);
    return 
1;

Da uma olhada no GM...

http://pastebin.com/n0i7SZBj

:/
Reply
#4

pawn Код:
// Public OnPlayerStateChange

new vid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
    if(vid == Grove[0] || vid == Grove[1] || vid == Grove[2] || vid == Grove[3])
    {
        if(pDados[playerid][Grove] == 1)
        {
             // Funзгo ao ser da grove o player
        }
        else
        {
             RemovePlayerFromVehicle(playerid);
        }
    }
}
return 1;
Pega como exemplo
Reply
#5

Quote:
Originally Posted by [THs]ShadoW
Посмотреть сообщение
Код:
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : error 012: invalid function call, not a valid address
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : warning 215: expression has no effect
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(131) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Linha:
PHP код:
if(newstate == PLAYER_STATE_DRIVERGroveCars(playerid); 
Complemento da linha :

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVERGroveCars(playerid);
    return 
1;

Da uma olhada no GM...

http://pastebin.com/n0i7SZBj

:/
Dar uma olhada nesse tуpico https://sampforum.blast.hk/showthread.php?tid=395339
Reply
#6

PQP.

Код:
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(133) : warning 211: possibly unintended assignment
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : warning 211: possibly unintended assignment
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : warning 211: possibly unintended assignment
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : warning 215: expression has no effect
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Geral\Meus documentos\Downloads\MAURICIO\samp03e_svr_R2_win32\gamemodes\TESTEGANGS2.pwn(135) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vid = GetPlayerVehicleID(playerid);
	if(newstate = PLAYER_STATE_DRIVER)
	{
    	if(vid = GroveCars[0] || vid = GroveCars[1] || vid = GroveCars[2] || GroveCars[3] || GroveCars[4] || GroveCars[5] || GroveCars[6])
    	{
        	if(pDados[playerid][Grove] == 1)
        	{
             	// Funзгo ao ser da grove o player
        	}
        	else
        	{
             	RemovePlayerFromVehicle(playerid);
        	}
	}
	return 1;
}
OnPlayerStateChange = Linha 130.
Reply
#7

Arrumei tenta agora

pawn Код:
// Public OnPlayerStateChange

new vid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
    if(vid == Grove[0] || vid == Grove[1] || vid == Grove[2] || vid == Grove[3])
    {
        if(pDados[playerid][Grove] == 1)
        {
             // Funзгo ao ser da grove o player
        }
        else
        {
             RemovePlayerFromVehicle(playerid);
        }
    }
}
return 1;
Reply
#8

Quote:
Originally Posted by Murilo_sousa
Посмотреть сообщение
Arrumei tenta agora

pawn Код:
// Public OnPlayerStateChange

new vid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
    if(vid == Grove[0] || vid == Grove[1] || vid == Grove[2] || vid == Grove[3])
    {
        if(pDados[playerid][Grove] == 1)
        {
             // Funзгo ao ser da grove o player
        }
        else
        {
             RemovePlayerFromVehicle(playerid);
        }
    }
}
return 1;
Nenhum erro ao compilar.. Entrando no server pra testar ...

#EDIT.

FUNCIONOU ! Obg ! +REP pra VC \o/
Reply
#9

Cuidado com esse sistema, se for moto e o cara for devagarzinho da pra burlar esse sistema, ele nгo й retirado do veiculo '-'. Tenta colocar ai ManualVehicleEngineAndLights(); e nгo usa TogglePlayerControllable porque й facil burlar tambem, й sу digitar algum comando que abra um dialog kkkk tipo /gps
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)