What's wrong?
#5

Quote:
Originally Posted by Thewin
Посмотреть сообщение
so post more code and errors
okay,
look.

I'm making a /engine command, but i want only people that are in a specified playerteam, can engine the vehicle with the same carteam.
So police = id 7, i put the car on 7 & every player id 7.
I want them to use /engine and if they arn't in that playerteam, they have to get the error ""You do not own this vehicle and you don't have the dupe keys!" .

This is my whole code for /engine

pawn Код:
COMMAND:engine(playerid, params[])
{
    new xr = GetPlayerVehicleID(playerid);
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new sender[MAX_STRING];
    new vehicleid = GetPlayerNearestVehicle(playerid);
    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(Vehicles[vehicleid][cartype]==3) return SendClientError(playerid, "Please use /rengine!");
        new State;
        State = GetPlayerState(playerid);
        if(State!=PLAYER_STATE_DRIVER)  return SendClientMessage(playerid,COLOR_GREY,"You are not the driver!");
        new vid = GetPlayerVehicleID(playerid);
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && (strcmp(PlayerInfo[playerid][playerteam],Vehicles[vehicleid][carteam],false)) && strcmp(Vehicles[vehicleid][carowner], "Unity_Station") && strcmp(Vehicles[vehicleid][carowner], "Truck_Depot") && strcmp(PlayerName(playerid),Vehicles[vehicleid][dupekey],false))
        {
            return SendClientError(playerid, "You do not own this vehicle and you don't have the dupe keys!");
        }
        //if(VehicleInfo[vid][iBroken]==1) return SendClientError(playerid,"Engine can not be started, Engine is broken");
        if(engine == 0)
        {
            SetVehicleParamsEx(vid, 1, lights, alarm, doors, bonnet, boot, objective);
            format(iStr, sizeof(iStr), "turns on the engine of the %s.", GetVehicleName(vehicleid));
            Action(playerid, iStr);
            TogglePlayerControllable(playerid, true);
        }
        else
        {
            SetVehicleParamsEx(vid, 0, lights, alarm, doors, bonnet, boot, objective);
            format(iStr, sizeof(iStr), "turns off the engine of the %s.", GetVehicleName(vehicleid));
            Action(playerid, iStr);
            TogglePlayerControllable(playerid, true);
        }
    }
    return 1;
}

this is the code i want to fix:

pawn Код:
new vid = GetPlayerVehicleID(playerid);
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(strcmp(PlayerName(playerid),Vehicles[vehicleid][carowner],false) && (strcmp(PlayerInfo[playerid][playerteam],Vehicles[vehicleid][carteam],false)) && strcmp(Vehicles[vehicleid][carowner], "Unity_Station") && strcmp(Vehicles[vehicleid][carowner], "Truck_Depot") && strcmp(PlayerName(playerid),Vehicles[vehicleid][dupekey],false))
        {
            return SendClientError(playerid, "You do not own this vehicle and you don't have the dupe keys!");
        }

i putted this in it:
pawn Код:
(strcmp(PlayerInfo[playerid][playerteam],Vehicles[vehicleid][carteam],false))
But still everyone with every playerteam can toggle the engine
Reply


Messages In This Thread
What's wrong? - by justjamie - 08.04.2016, 15:45
Respuesta: What's wrong? - by Thewin - 08.04.2016, 15:49
Re: Respuesta: What's wrong? - by justjamie - 08.04.2016, 15:50
Respuesta: What's wrong? - by Thewin - 08.04.2016, 15:51
Re: Respuesta: What's wrong? - by justjamie - 08.04.2016, 15:54
Respuesta: What's wrong? - by Thewin - 08.04.2016, 16:07
Respuesta: What's wrong? - by Thewin - 08.04.2016, 16:13
Re: Respuesta: What's wrong? - by justjamie - 08.04.2016, 16:13
Respuesta: What's wrong? - by Thewin - 08.04.2016, 16:16
Respuesta: What's wrong? - by Thewin - 08.04.2016, 16:19
Re: Respuesta: What's wrong? - by justjamie - 08.04.2016, 16:21

Forum Jump:


Users browsing this thread: 1 Guest(s)