Help with code, why do i get these errors? - 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: Help with code, why do i get these errors? (
/showthread.php?tid=82704)
Help with code, why do i get these errors? -
Bofhead - 20.06.2009
Hi i am trying to code it so that when the player enters into the checkpoint it first-
checks to see whether he is in a vehicle-if not it deletes the checkpoint.
if he is in vehicle i need to check whether trailer is attached..
Hopefully you can see what i am trying to do by my code.
Код:
public OnPlayerEnterCheckpoint(playerid) {
new vehicleid=GetPlayerVehicleID( playerid );
if (IsPlayerInVehicle(playerid,vehicleid) ) {
if ( IsTrailerAttachedToVehicle(vehicleid) );
{
SendClientMessage( playerid, 0xAFAFAFAA, " Congratulations!" );
GivePlayerMoney(playerid, 5000);
DisablePlayerCheckpoint(playerid);
}
else {
SendClientMessage( playerid, 0xAFAFAFAA, "You need a trailer." );
}}
else { DisablePlayerCheckpoint(playerid);
}
return 1;
}
i get two errors when i compile this.
: error 029: invalid expression, assumed zero
: error 036: empty statement
Thanks in advance,
josh
Re: Help with code, why do i get these errors? -
MenaceX^ - 20.06.2009
if ( IsTrailerAttachedToVehicle(vehicleid) )
;
Re: Help with code, why do i get these errors? -
AiVAMAN - 20.06.2009
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid,vehicleid))
{
if(IsTrailerAttachedToVehicle(vehicleid))
{
SendClientMessage(playerid, 0xAFAFAFAA, "Congratulations!");
GivePlayerMoney(playerid, 5000);
DisablePlayerCheckpoint(playerid);
}
else
{
SendClientMessage(playerid, 0xAFAFAFAA, "You need a trailer.");
}
}
else
{
DisablePlayerCheckpoint(playerid);
}
return 1;
}
it compiles for me with no errors
Re: Help with code, why do i get these errors? -
Yuryfury - 25.06.2009
Try this:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid,vehicleid) && IsTrailerAttachedToVehicle(vehicleid))
{
SendClientMessage(playerid, 0xAFAFAFAA, "Congratulations!");
GivePlayerMoney(playerid, 5000);
DisablePlayerCheckpoint(playerid);
}
else
{
SendClientMessage(playerid, 0xAFAFAFAA, "You need a trailer.");
DisablePlayerCheckpoint(playerid);
}
return 1;
}
This way the player has to be in the specified vehicle AND have the trailer attached.
Compiles with no errors