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