I can still turns on all vehicle engine.
#1

I wanted for some for owned vehicle can't be turns the engine expect the owner. And also CIV can be used by all players.

This is my /engine command.

pawn Код:
COMMAND:engine(playerid, params[])
{
    new xr = GetPlayerVehicleID(playerid);
    new car = GetPlayerNearestVehicle(playerid);
    new vehicleid = GetPlayerNearestVehicle(playerid);
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new sender[MAX_STRING];
    //Vehicles[GetPlayerVehicleID(playerid)][carteam] != CIV
    if(PlayerTemp[playerid][hname]==1) myStrcpy(sender,"Stranger");
    else myStrcpy(sender,NameEx(playerid));
    if(IsPlayerInAnyVehicle(playerid) && Vehicles[xr][carmodel] == 481 && Vehicles[xr][carmodel] == 509) return SendClientError(playerid, "You are not in any vehicle, or there is no engine implented.");
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientError(playerid, "You are not in any vehicle!");
        new State;
        State = GetPlayerState(playerid);
        if(State!=PLAYER_STATE_DRIVER)  return SendClientMessage(playerid,COLOR_GREY,"You are not the driver!");
        new stringa[MAX_STRING];
        new vid = GetPlayerVehicleID(playerid);
        if(!Vehicles[vehicleid][carteam] && !strcmp(Vehicles[vehicleid][carowner],"NoBodY",true) && Vehicles[GetPlayerVehicleID(playerid)][carteam] != PlayerInfo[playerid][playerteam] && strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && strcmp(PlayerName(playerid),Vehicles[vehicleid][dupekey],false))
        {
            return SendClientError(playerid, "You don't have the authority to use this vehicle or you don't have the dupe keys!");
        }
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(engine == 0)
        {
            SetVehicleParamsEx(vid, 1, lights, alarm, doors, bonnet, boot, objective);
            format(stringa,sizeof(stringa),"%s has turns on the engine of the %s.",sender,GetVehicleName(car));
            NearMessage(playerid,stringa,COLOR_ME2);
            TogglePlayerControllable(playerid, true);
        }
        else
        {
            SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, objective);
            format(stringa,sizeof(stringa),"%s has turns off the engine of the %s.",sender,GetVehicleName(car));
            NearMessage(playerid,stringa,COLOR_ME2);
            TogglePlayerControllable(playerid, true);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)