SA-MP Forums Archive
Problem with Reserving Car for a Player - 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)
+--- Thread: Problem with Reserving Car for a Player (/showthread.php?tid=330149)



Problem with Reserving Car for a Player - Deminitous - 31.03.2012

Hi there.

Could any1 please help me with this...
I want to make a car reservation on the server but PAWNO so totally against it. LoL

The PAWN text:

pawn Код:
9868        public OnPlayerStateChange(playerid, newstate, oldstate)
9869        {
9870            if(newstate == PLAYER_STATE_DRIVER)
9871            {
9872                 new name[MAX_PLAYER_NAME];
9873                 GetPlayerName(playerid, name, sizeof(name));
9874                 if(GetPlayerVehicleID(playerid) == Dual1 && strfind(name(playerid), "[Sfcnr]Dual", true), == -1);
9875                 {
9876                    new Float:X,Float:Y,Float:Z;
9877                     SendClientMessage(playerid, COLOR_RED, "This car belongs to: [Sfcnr]Dual!!");
9878                    SetPlayerPos(playerid, X,Y,Z+5);
9879                }
9880            }

And this is the Errors i get:

Quote:

C:\Documents and Settings\...\sfcnr2.0.pwn(9874) : error 012: invalid function call, not a valid address
C:\Documents and Settings\...\sfcnr2.0.pwn(9874) : warning 215: expression has no effect
C:\Documents and Settings\...\sfcnr2.0.pwn(9874) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\...\sfcnr2.0.pwn(9874) : error 029: invalid expression, assumed zero
C:\Documents and Settings\...\sfcnr2.0.pwn(9874) : fatal error 107: too many error messages on one line

I already looked at 2 topics created

This is where i got it
This is another topic i read about Vehicle Reservation

Hope some1 can see whats wrong here... :/


Re: Problem with Reserving Car for a Player - Joshb93 - 31.03.2012

Try this instead:

EDIT: Sorry, its this...

pawn Код:
if(GetPlayerVehicleID(playerid) == Dual1 && strcmp(name, "[Sfcnr]Dual", true), == 0);
This forum requires that you wait 120 seconds between posts. Please try again in 8 seconds. <- suck ma balls


Re: Problem with Reserving Car for a Player - Deminitous - 31.03.2012

Quote:
Originally Posted by Joshb93
Посмотреть сообщение
Try this instead:

EDIT: Sorry, its this...

pawn Код:
if(GetPlayerVehicleID(playerid) == Dual1 && strcmp(name, "[Sfcnr]Dual", true), == 0);
This forum requires that you wait 120 seconds between posts. Please try again in 8 seconds. <- suck ma balls
Replaced the code and i get the exact same error :/


Re: Problem with Reserving Car for a Player - Joshb93 - 31.03.2012

LOL! I found the mistake!

pawn Код:
if(GetPlayerVehicleID(playerid) == Dual1 && strcmp(name, "[Sfcnr]Dual", true) == 0);
: Just copy that code, and try


Re: Problem with Reserving Car for a Player - Deminitous - 31.03.2012

Now dow to 1 error :/

Quote:

C:\Documents and Settings\...\sfcnr2.0.pwn(9874) : error 036: empty statement




Re: Problem with Reserving Car for a Player - Kiets - 31.03.2012

change 9874 line to this
Код:
if(GetPlayerVehicleID(playerid) == Dual1 && strcmp(name, "[Sfcnr]Dual", true) == 0)



Re: Problem with Reserving Car for a Player - Joshb93 - 31.03.2012

Quote:
Originally Posted by Kiets
Посмотреть сообщение
change 9874 line to this
Код:
if(GetPlayerVehicleID(playerid) == Dual1 && strcmp(name, "[Sfcnr]Dual", true) == 0)
Ahh yes, he has a ( ; ) there.

Remember, NEVER put a semicolon ( ; ) at the end of an "if" statement.


Re: Problem with Reserving Car for a Player - Deminitous - 31.03.2012

Quote:
Originally Posted by Joshb93
Посмотреть сообщение
Ahh yes, he has a ( ; ) there.

Remember, NEVER put a semicolon ( ; ) at the end of an "if" statement.
Thanx. Problem solved

Thanx for your time guys, and help

Much appreciated.

My Server IP: 176.9.46.83:9622


Re: Problem with Reserving Car for a Player - [ABK]Antonio - 31.03.2012

Change it to != 0 instead of == 0 (== 0 means that it's that persons name)


Re: Problem with Reserving Car for a Player - Deminitous - 31.03.2012

If your name isnt [Sfcnr]Dual then you must not be able to drive the car. You must be kicked out of the car if this is not your name.

Thats what im trying to do here :/