SA-MP Forums Archive
More than code under OnPlayerEnterVehicle. - 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: More than code under OnPlayerEnterVehicle. (/showthread.php?tid=67728)



More than code under OnPlayerEnterVehicle. - Cevarr - 03.03.2009

Hey,

I have a problem, when i try to add more than one code under OnPlayerEnterVehicle it does not work, one compiles fine tho

here is my code;

pawn Код:
if (GVM(vehicleid) == 534 || GVM(vehicleid) == 566 || GVM(vehicleid) == 535 || GVM(vehicleid) == 567 || GVM(vehicleid) == 412 && GPS(playerid) == 114 || GPS(playerid) == 115 || GPS(playerid) == 116 || GPS(playerid) == 173 || GPS(playerid) == 174 || GPS(playerid) == 175 || GPS(playerid) == 48)
    {
    SendClientMessage(playerid,0xFFFFFFAA,"Welcome to your faction's vehicle!");
    }
    else
    {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetPlayerPos(playerid, X, Y, Z);
                SendClientMessage(playerid,0x63AFF00A,"You don't have the keys for this vehicle!");
                }
                return 1;
        }
then here it is with more than just that one;

pawn Код:
if (GVM(vehicleid) == 534 || GVM(vehicleid) == 566 || GVM(vehicleid) == 535 || GVM(vehicleid) == 567 || GVM(vehicleid) == 412 && GPS(playerid) == 114 || GPS(playerid) == 115 || GPS(playerid) == 116 || GPS(playerid) == 173 || GPS(playerid) == 174 || GPS(playerid) == 175 || GPS(playerid) == 48)
    {
    SendClientMessage(playerid,0xFFFFFFAA,"Welcome to your faction's vehicle!");
    }
    else
    {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetPlayerPos(playerid, X, Y, Z);
                SendClientMessage(playerid,0x63AFF00A,"You don't have the keys for this vehicle!");
                }
                return 1;
        }

    else if (GVM(vehicle) == 567 && GPS(playerid) == 109)
    {
        SendClientMessage(playerid,0xFFFFFFAA,"Welcome to your faction's vehicle!");
    }
    else
    {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetPlayerPos(playerid, X, Y, Z);
                SendClientMessage(playerid,0x63AFF00A,"You don't have the keys for this vehicle!");
                }
                return 1;
        }
NOTE; GVM is for GetVehicleModel and GPS is for GetPlayerSkin

I then get these erros/warnings;

Код:
 : warning 219: local variable "X" shadows a variable at a preceding level
 : warning 219: local variable "Y" shadows a variable at a preceding level
 : warning 219: local variable "Z" shadows a variable at a preceding level
 : warning 219: local variable "X" shadows a variable at a preceding level
 : warning 219: local variable "Y" shadows a variable at a preceding level
 : warning 219: local variable "Z" shadows a variable at a preceding level
 : error 010: invalid function or declaration
 : error 010: invalid function or declaration
 : error 021: symbol already defined: "GetPlayerPos"
 : error 010: invalid function or declaration
: warning 203: symbol is never used: "X"
: warning 203: symbol is never used: "Y"
 : warning 203: symbol is never used: "Z"
all of which feature on the lines i've submitted.

Any help pls?


Re: More than code under OnPlayerEnterVehicle. - Rks25 - 03.03.2009

Show complete ONPlayerEnterVehicle(onpastebin).


Re: More than code under OnPlayerEnterVehicle. - Cevarr - 03.03.2009

http://pastebin.com/m29798fe0

Thts the one with errors.


Re: More than code under OnPlayerEnterVehicle. - Rks25 - 03.03.2009

Try:
http://pastebin.com/m129d2979


Re: More than code under OnPlayerEnterVehicle. - Cevarr - 03.03.2009

Thanks, that has helped, only i get these errors now;

Код:
error 029: invalid expression, assumed zero
: warning 215: expression has no effect
 : error 001: expected token: ";", but found "if"
error is on this line;

pawn Код:
else if (GVM(vehicleid) == 567 && GPS(playerid) == 109)
:S


Re: More than code under OnPlayerEnterVehicle. - Rks25 - 03.03.2009

for which lines?


Re: More than code under OnPlayerEnterVehicle. - Cevarr - 03.03.2009

I already edited previous post with the line

pawn Код:
else if (GVM(vehicleid) == 567 && GPS(playerid) == 109)
all on that one


Re: More than code under OnPlayerEnterVehicle. - Rks25 - 03.03.2009

GPS[playerid] instead of GPS(playerid)


Re: More than code under OnPlayerEnterVehicle. - Cevarr - 03.03.2009

that just gives me more errors


Re: More than code under OnPlayerEnterVehicle. - Finn - 03.03.2009

if -> else -> else if -> else

It just doesn't work.