SA-MP Forums Archive
Command problem (rep+) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command problem (rep+) (/showthread.php?tid=309409)



Command problem (rep+) - Tanush123 - 07.01.2012

Well i was making /engine and when i use it outside a car it shows you are not driving a car (that works good) but when i enter a car as a driver and use it, it returns 0 to me
pawn Код:
CMD:engine(playerid, params[])
{
    if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid,red,"ERROR: You are not driving a vehicle!");
    new vid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vengine[vid] == 0)
    {
        SetVehicleParamsEx( vid,1, lights, alarm, doors, bonnet, boot, objective );
        SendClientMessage(playerid,orange,"You have turned on your vehicle engine!");
        vengine[vid] = 1;
    }
    else if(vengine[vid] == 1)
    {
        SetVehicleParamsEx( vid,0, lights, alarm, doors, bonnet, boot, objective );
        SendClientMessage(playerid,orange,"You have turned off your vehicle engine!");
        vengine[vid] = 0;
    }
    return 1;
}



Re: Command problem (rep+) - Konstantinos - 07.01.2012

pawn Код:
CMD:engine(playerid, params[])
{
    if(GetPlayerState(playerid) != 0) return SendClientMessage(playerid,red,"ERROR: You are not driving a vehicle!");
    new vid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vengine[vid] == 0)
    {
        SetVehicleParamsEx( vid,1, lights, alarm, doors, bonnet, boot, objective );
        SendClientMessage(playerid,orange,"You have turned on your vehicle engine!");
        vengine[vid] = 1;
    }
    else if(vengine[vid] == 1)
    {
        SetVehicleParamsEx( vid,0, lights, alarm, doors, bonnet, boot, objective );
        SendClientMessage(playerid,orange,"You have turned off your vehicle engine!");
        vengine[vid] = 0;
    }
    return 1;
}



Re: Command problem (rep+) - Tanush123 - 07.01.2012

i want to make the state if they are in a car as a driver -_-


Re: Command problem (rep+) - Konstantinos - 07.01.2012

I did a mistake on Player's seat. I am really not sure why this happens.
pawn Код:
CMD:engine(playerid, params[])
{
    new playerState = GetPlayerState(playerid);
    if(playerState != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,red,"ERROR: You are not driving a vehicle!");
    new vid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vengine[vid] == 0)
    {
        SetVehicleParamsEx( vid,1, lights, alarm, doors, bonnet, boot, objective );
        SendClientMessage(playerid,orange,"You have turned on your vehicle engine!");
        vengine[vid] = 1;
    }
    else if(vengine[vid] == 1)
    {
        SetVehicleParamsEx( vid,0, lights, alarm, doors, bonnet, boot, objective );
        SendClientMessage(playerid,orange,"You have turned off your vehicle engine!");
        vengine[vid] = 0;
    }
    return 1;
}



Re: Command problem (rep+) - Tanush123 - 07.01.2012

wont work still, unkown command