Problem in car
#1

I use this code for regular players cars
Код:
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    if(GetPlayerVehicleID(playerid) == RegularVehicle1 || GetPlayerVehicleID(playerid) == RegularVehicle2 ||
	    GetPlayerVehicleID(playerid) == RegularVehicle3 || GetPlayerVehicleID(playerid) == RegularVehicle4 ||
	    GetPlayerVehicleID(playerid) == RegularVehicle4 || GetPlayerVehicleID(playerid) == RegularVehicle5 ||
	    GetPlayerVehicleID(playerid) == RegularVehicle5 || GetPlayerVehicleID(playerid) == RegularVehicle6 ||
	    GetPlayerVehicleID(playerid) == RegularVehicle7 || GetPlayerVehicleID(playerid) == RegularVehicle8 ||
        GetPlayerVehicleID(playerid) == RegularVehicle9 || GetPlayerVehicleID(playerid) == RegularVehicle10 ||
        GetPlayerVehicleID(playerid) == RegularVehicle11 || GetPlayerVehicleID(playerid) == RegularVehicle12 ||
        GetPlayerVehicleID(playerid) == RegularVehicle13 || GetPlayerVehicleID(playerid) == RegularVehicle14 ||
        {
		    if(IsRegularPlayer[playerid] != 1337)
		    {
				SendClientMessage(playerid,COLOR_ERROR,"Only Regular Players can use this vehicle.");
				RemovePlayerFromVehicle(playerid);
		        return 1;
			}
			SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Regular Player_]]");
			SendClientMessage(playerid,COLOR_LIME,"Welcome to your Rgular Player vehicle.");
			return 1;
		}
	}
But it always gets this ERROR
Код:
C:\Users\user\Downloads\Downloads\SFCRRPGv1.1\edit one\gamemodes\SFCRRPG.pwn(10246) : error 029: invalid expression, assumed zero
C:\Users\user\Downloads\Downloads\SFCRRPGv1.1\edit one\gamemodes\SFCRRPG.pwn(10246) : warning 215: expression has no effect
C:\Users\user\Downloads\Downloads\SFCRRPGv1.1\edit one\gamemodes\SFCRRPG.pwn(10246) : error 001: expected token: ";", but found ")"
C:\Users\user\Downloads\Downloads\SFCRRPGv1.1\edit one\gamemodes\SFCRRPG.pwn(10246) : error 029: invalid expression, assumed zero
C:\Users\user\Downloads\Downloads\SFCRRPGv1.1\edit one\gamemodes\SFCRRPG.pwn(10246) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

You missed a ')':
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    if(GetPlayerVehicleID(playerid) == RegularVehicle1 || GetPlayerVehicleID(playerid) == RegularVehicle2 ||
    GetPlayerVehicleID(playerid) == RegularVehicle3 || GetPlayerVehicleID(playerid) == RegularVehicle4 ||
    GetPlayerVehicleID(playerid) == RegularVehicle4 || GetPlayerVehicleID(playerid) == RegularVehicle5 ||
    GetPlayerVehicleID(playerid) == RegularVehicle5 || GetPlayerVehicleID(playerid) == RegularVehicle6 ||
    GetPlayerVehicleID(playerid) == RegularVehicle7 || GetPlayerVehicleID(playerid) == RegularVehicle8 ||
    GetPlayerVehicleID(playerid) == RegularVehicle9 || GetPlayerVehicleID(playerid) == RegularVehicle10 ||
    GetPlayerVehicleID(playerid) == RegularVehicle11 || GetPlayerVehicleID(playerid) == RegularVehicle12 ||
    GetPlayerVehicleID(playerid) == RegularVehicle13 || GetPlayerVehicleID(playerid) == RegularVehicle14)
    {
        if(IsRegularPlayer[playerid] != 1337)
        {
            SendClientMessage(playerid,COLOR_ERROR,"Only Regular Players can use this vehicle.");
            RemovePlayerFromVehicle(playerid);
            return 0;
        }
        SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Regular Player_]]");
        SendClientMessage(playerid,COLOR_LIME,"Welcome to your Rgular Player vehicle.");
        return 1;
    }
}
Reply
#3

Try:

PHP код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        if(
GetPlayerVehicleID(playerid) == RegularVehicle1 || GetPlayerVehicleID(playerid) == RegularVehicle2 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle3 || GetPlayerVehicleID(playerid) == RegularVehicle4 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle4 || GetPlayerVehicleID(playerid) == RegularVehicle5 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle5 || GetPlayerVehicleID(playerid) == RegularVehicle6 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle7 || GetPlayerVehicleID(playerid) == RegularVehicle8 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle9 || GetPlayerVehicleID(playerid) == RegularVehicle10 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle11 || GetPlayerVehicleID(playerid) == RegularVehicle12 ||
        
GetPlayerVehicleID(playerid) == RegularVehicle13 || GetPlayerVehicleID(playerid) == RegularVehicle14 ||)
        {
            if(
IsRegularPlayer[playerid] != 1337)
            {
                
SendClientMessage(playerid,COLOR_ERROR,"Only Regular Players can use this vehicle.");
                
RemovePlayerFromVehicle(playerid);
                return 
1;
            }
            
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Regular Player_]]");
            
SendClientMessage(playerid,COLOR_LIME,"Welcome to your Rgular Player vehicle.");
            return 
1;
        }
    } 
Reply
#4

thanks bothh , Repped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)