[HELP] Add function only owner of the vehicle or of the faction turn it on -
AtomicSAMP - 08.11.2015
Hi, I'm using SC-RP script, help-me command engine just to owners or members of the faction turn it on.
Код:
CMD:motor(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
if (!IsEngineVehicle(vehicleid))
return SendErrorMessage(playerid, "Vocк nгo estб em um veiculo.");
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
return SendErrorMessage(playerid, "Vocк nгo pode fazer isso porque nгo estб de motorista.");
if (CoreVehicles[vehicleid][vehFuel] < 1)
return SendErrorMessage(playerid, "Este veiculo estб sem combustнvel.");
if (ReturnVehicleHealth(vehicleid) <= 300)
return SendErrorMessage(playerid, "Este veiculo estб quebrado e nгo pode ser ligado.");
switch (GetEngineStatus(vehicleid))
{
case false:
{
SetEngineStatus(vehicleid, true);
//ShowPlayerFooter(playerid, "Voce ~g~ligou~w~ o motor!");
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s insere a chave na igniзгo e liga o motor.", ReturnName(playerid, 0));
}
case true:
{
SetEngineStatus(vehicleid, false);
//ShowPlayerFooter(playerid, "Voce ~r~desligou~w~ o motor!");
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s gira a chave na igniзгo e desliga o motor.", ReturnName(playerid, 0));
}
}
return 1;
}
Re: [HELP] Add function only owner of the vehicle or of the faction turn it on -
Ritzy2K - 08.11.2015
Check with an if statement if the player belong to specific faction or not?
Re: [HELP] Add function only owner of the vehicle or of the faction turn it on -
AtomicSAMP - 08.11.2015
Yep, PlayerData[i][pFaction].
Re: [HELP] Add function only owner of the vehicle or of the faction turn it on -
AtomicSAMP - 08.11.2015
HELP!!!
Re: [HELP] Add function only owner of the vehicle or of the faction turn it on -
AtomicSAMP - 08.11.2015
up!!
Re: [HELP] Add function only owner of the vehicle or of the faction turn it on -
IzadorO - 09.11.2015
Create a new variable, under your player data enum.
Such as: pInfo[playerid][CarID] - so CarID,
Then link it to the vehicle ID as soon as their vehicle spawns.
Then on top of your motor command, input: if(vehicleid != pInfo[playerid][CarID]) return SendClientMessage(playerid, color, message);
Replace the above with your own code.
For factions, do the same, except detect if it's first a faction vehicle, and then create a car faction variable, and have faction car set to the faction's ID.