SA-MP Forums Archive
Engine command gone wrong :O - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Engine command gone wrong :O (/showthread.php?tid=149390)



Engine command gone wrong :O - Antonio [G-RP] - 22.05.2010

Simply, the damn thing can't tell whether the car is a factioncar or an ownable car. (FactionCar = faction, CInfo = ownable)

Please help?

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
{
new carid = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You aren't in a vehicle!");
return 1;
}
if(CInfo[carid-1][cEngine] == 0)
{
OnPlayerCommandText(playerid, "/me spins the key and successfully starts the engine");
TogglePlayerControllable(playerid, 1);
CInfo[carid-1][cEngine] = 1;
return 1;
}
if(CInfo[carid-1][cEngine] == 0)
{
OnPlayerCommandText(playerid, "/me spins the key and shuts off the engine");
TogglePlayerControllable(playerid, 0);
CInfo[carid-1][cEngine] = 0;
return 1;
}
if(FactionCar[carid][fcFaction] != PlayerInfo[playerid][pFaction])
{
OnPlayerCommandText(playerid, "/me tries to start the engine, but fails");
SendClientMessage(playerid, COLOR_GREY, "You don't have the keys for this vehicle!");
return 1;
}
if(FactionCar[carid][fcEngine] == 0)
{
OnPlayerCommandText(playerid, "/me spins the key and successfully starts the engine");
TogglePlayerControllable(playerid, 1);
FactionCar[carid][fcEngine] = 1;
return 1;
}
if(FactionCar[carid][fcEngine] == 1)
{
OnPlayerCommandText(playerid, "/me spins the key and shuts off the engine");
TogglePlayerControllable(playerid, 0);
FactionCar[carid][fcEngine] = 0;
}
return 1;
}



Re: Engine command gone wrong :O - Antonio [G-RP] - 22.05.2010

Yeah, help please


Re: Engine command gone wrong :O - Bayler - 22.05.2010

Damn Antonio .... You get into this big as stupid fight with Dan, Split off, and now you cant even manage to figure your own shit out...

Here .. ILL feel sorry for ya and point you in the right direction.

1) You should have stuck with a community that had someone that could build

2) You should have fired the 'Cheerleader Squad that follows you around believing you can actually do what you claim.

3) You 'If Statment' has multi results because your using if statements and not 'else if'

Example:
Код:
if(YouWasntA[Idiot]==VAR){
// result ( You Wouldnt struggle
} else if(YouCouldScript[basic]==VAR) {
//result You wouldnt be here asking
} else {
// You really wouldn't be relying on everyone else to do for you
}



Re: Engine command gone wrong :O - Antonio [G-RP] - 22.05.2010

Dont comment if your not gonna help


Re: Engine command gone wrong :O - Bayler - 22.05.2010

believe it or not ...

the 'Code' post shows the solution to your problem ...

However, a little Further Advice, as my grandfather once told me...

Dont ask a Question if your not going to be satisfied with the answer!


Re: Engine command gone wrong :O - Antonio [G-RP] - 22.05.2010

Atcually, It didnt, it always says "You don't have the keys for this vehicle!"


Re: Engine command gone wrong :O - Bayler - 22.05.2010

and again, its because of the 50 IF(THIS) statments ..

your if(CHECKS) ...the 'CHECKS' are your problem

Hell, you managed to get a copy of my Core, look through it and use it as an example.