Problem with Reserving Car for a Player
#1

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... :/
Reply
#2

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
Reply
#3

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 :/
Reply
#4

LOL! I found the mistake!

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

Now dow to 1 error :/

Quote:

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

Reply
#6

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

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.
Reply
#8

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
Reply
#9

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

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 :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)