SA-MP Forums Archive
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: Errors (/showthread.php?tid=201609)



Errors - Rock18 - 21.12.2010

Код:
C:\Documents and Settings\Sebastian\Desktop\usercp.pwn(218) : error 017: undefined symbol "oldstate"
C:\Documents and Settings\Sebastian\Desktop\usercp.pwn(220) : error 017: undefined symbol "newstate"
C:\Documents and Settings\Sebastian\Desktop\usercp.pwn(228) : error 017: undefined symbol "oldstate"
C:\Documents and Settings\Sebastian\Desktop\usercp.pwn(230) : error 017: undefined symbol "newstate"
C:\Documents and Settings\Sebastian\Desktop\usercp.pwn(238) : error 017: undefined symbol "oldstate"
C:\Documents and Settings\Sebastian\Desktop\usercp.pwn(240) : error 017: undefined symbol "newstate"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
220
Код:
if(newstate == PLAYER_STATE_ONFOOT)
228
Код:
if(oldstate == PLAYER_STATE_PASSENGER)
230
Код:
if(newstate == PLAYER_STATE_ONFOOT)
238
Код:
if(oldstate == PLAYER_STATE_ONFOOT)
240
Код:
if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)
Pls HELP !


Re: Errors - DJDhan - 21.12.2010

Firstly;
Код:
if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)
should be
Код:
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
Secondly, you do have this under OnPlayerStateChange callback, don't you?


Re: Errors - Rock18 - 21.12.2010

Yes...this are the lines were i get that errors
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(Act[playerid] == 1)
        {
                if(oldstate == PLAYER_STATE_DRIVER)
                {
                        if(newstate == PLAYER_STATE_ONFOOT)
                        {
                                if(InCar[playerid] == 1)
                                {
                                        PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);
                                }
                        }
                }
                if(oldstate == PLAYER_STATE_PASSENGER)
                {
                        if(newstate == PLAYER_STATE_ONFOOT)
                        {
                                if(InCar[playerid] == 1)
                                {
                                        PutPlayerInVehicle(playerid, WhatCar[playerid], Passanger);
                                }
                        }
                }
                if(oldstate == PLAYER_STATE_ONFOOT)
                {
                        if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)
                        {
                                InCar[playerid] = 1;
                                WhatCar[playerid] = GetPlayerVehicleID(playerid);
                        }
                }
        }



Re: Errors - DJDhan - 21.12.2010

OnPlayerStateChange and OnPlayerKeyStateChange are two different callbacks.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(Act[playerid] == 1)
	{
		if(oldstate == PLAYER_STATE_DRIVER)
		{
			if(newstate == PLAYER_STATE_ONFOOT)
			{
				if(InCar[playerid] == 1) PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);
			}
		}
		if(oldstate == PLAYER_STATE_PASSENGER)
		{
			if(newstate == PLAYER_STATE_ONFOOT)
			{
				if(InCar[playerid] == 1) PutPlayerInVehicle(playerid, WhatCar[playerid], Passanger);
			}
		}
		if(oldstate == PLAYER_STATE_ONFOOT)
		{
			if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
			{
				InCar[playerid] = 1;
				WhatCar[playerid] = GetPlayerVehicleID(playerid);
			}
		}
	}
	return 1;
}



Re: Errors - Rock18 - 21.12.2010

Thx man ! it works !