HELP I GET ERROR ON A AUTO REPAIR
#1

hi i tried making a auto rapiar here is my code

Код:
 	if(IsPlayerInAnyVehicle(playerid)
 	{
    	new Float:vhealth;GetVehicleHealth(GetPlayerVehicleID(playerid),vhealth);
    	if(vhealth<250)
	 	{
 			RepairVehicle(GetPlayerVehicleID(playerid));
    		SetVehicleHealth(GetPlayerVehicleID(playerid),999);
		  	GameTextForPlayer((playerid,"~g~Auto ~w~Fix",1500,3);
		}
	}
and my errors

Код:
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(298) : error 017: undefined symbol "playerid"
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(300) : error 017: undefined symbol "playerid"
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(303) : error 017: undefined symbol "playerid"
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(304) : error 017: undefined symbol "playerid"
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(305) : error 017: undefined symbol "playerid"
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(305) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

Where did you put this ?
Reply
#3

in game mode
Reply
#4

like after what.
after what line
Reply
#5

here wat it look like

Код:
public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("FreeRoam");
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//													Player Class													//
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	for(new i=0;i<300;i++)
	{
	  if((i == 7)||(i >= 9 && i <= 41)||(i >= 43 && i <= 64)||(i >= 66 && i <= 73)
	  ||(i >= 75 && i <= 85)||(i >= 87 && i <= 118)||(i >= 120 && i <= 148)||(i >= 150 && i <= 207)
	  ||(i >= 209 && i <= 264)||(i >= 274 && i <= 288)||(i >= 290 && i <= 299))
	  {
	   AddPlayerClass(i, -1422.8820, -287.4992, 14.1484, 269.1088, 4, 1, 29, 400, 31, 550);
	  }
	}
	
 	/*if(IsPlayerInAnyVehicle(playerid)
 	{
    	new Float:vhealth;GetVehicleHealth(GetPlayerVehicleID(playerid),vhealth);
    	if(vhealth<250)
	 	{
 			RepairVehicle(GetPlayerVehicleID(playerid));
    		SetVehicleHealth(GetPlayerVehicleID(playerid),999);
		  	GameTextForPlayer(playerid,"~g~Auto ~w~Fix",1500,3);
		}
	}*/
Reply
#6

Try moving it to this callback, if it's not a callback, just copy this and put it somewhere not on OnGameModeInIt:
pawn Код:
public OnPlayerUpdate(playerid) // Update CallBack
{
    if(IsPlayerInAnyVehicle(playerid)
    {
        new Float:vhealth;GetVehicleHealth(GetPlayerVehicleID(playerid),vhealth);
        if(vhealth<250)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid),999);
            GameTextForPlayer((playerid,"~g~Auto ~w~Fix",1500,3);
        }
    }
    return 1; // Send this update to other players.
}
This has not been tested.
Reply
#7

i get this error by moving it

Quote:

C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(1884) : error 001: expected token: ")", but found "{"
C:\Users\Family\Desktop\FastFive v2.0.1\gamemodes\free.pwn(1890) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Reply
#8

never mind fix it missinf cople things

Quote:

public OnPlayerUpdate(playerid) // Update CallBack
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:vhealth;GetVehicleHealth(GetPlayerVehicleID( playerid),vhealth);
if(vhealth<250)
{
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid),999) ;
GameTextForPlayer(playerid,"~g~Auto ~w~Fix",1500,3);
}
}
return 1; // Send this update to other players.
}

Reply
#9

Correct:

pawn Код:
public OnPlayerUpdate(playerid) // Update CallBack
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Float:vhealth;
        GetVehicleHealth(GetPlayerVehicleID(playerid),vhealth);
        if(vhealth<250)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid),999);
            GameTextForPlayer(playerid,"~g~Auto ~w~Fix",1500,3);
        }
    }
    return 1; // Send this update to other players.
}
Edit: Oops, I didn't see you post another post lol.
Reply
#10

its ok and thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)