Private car help
#1

i have a private car setup for a friend but im having problems
stock PlayerName(playerid)
{
new PlrName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PlrName,sizeof(PlrName));
return PlrName;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new pid;
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(vehicleid == xxannajpxx)
{
if(strcmp(PlayerName(playerid), "Anna_Cortez", true) != 0)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "You dare touch The car of Anna_Cortez? PERISH IN HELL!!! ");
GetPlayerPos(pid,x,y,z);
CreateExplosion(x,y,z,0,5.0);
SetPlayerHealth(playerid, 0);
}
}
return 1;
}



the errors are as followed:



C:\Documents and Settings\Majdi Khammash\Desktop\worlddm\gamemodes\fixed.pwn(855) : error 017: undefined symbol "x"
C:\Documents and Settings\Majdi Khammash\Desktop\worlddm\gamemodes\fixed.pwn(856) : error 017: undefined symbol "x"
C:\Documents and Settings\Majdi Khammash\Desktop\worlddm\gamemodes\fixed.pwn(859) : warning 217: loose indentation
C:\Documents and Settings\Majdi Khammash\Desktop\worlddm\gamemodes\fixed.pwn(861) : error 030: compound statement not closed at the end of file (started at line 845)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#2

Код:
stock PlayerName(playerid)
{
	new Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	return Name;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	
	if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
	{
		new VehicleID = GetPlayerVehicleID(playerid);
		
		if(strcmp(PlayerName(playerid), "Anna_Cortez", true) != 0)
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, COLOR_RED, "You dare touch The car of Anna_Cortez? PERISH IN HELL!!! ");
			
			new Float:x, Float:y, Float:z;
			
			GetPlayerPos(playerid, x, y, z);
			CreateExplosion(x, y, z, 0, 5.0);
			
			SetPlayerHealth(playerid, 0);
		}
	}
	
	return 1;
}
Untested. Indentation always helps.
Reply
#3

testing now
Reply
#4

umm can ye add the par that defines the name of car which would be something like :
{
if(vehicleid == xander)
{
Reply
#5

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	
	if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
	{
		new VehicleID = GetPlayerVehicleID(playerid);
		
		if(VehicleID == xander)
		{
		
			if(strcmp(PlayerName(playerid), "Anna_Cortez", true) != 0)
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid, COLOR_RED, "You dare touch The car of Anna_Cortez? PERISH IN HELL!!! ");
				
				new Float:x, Float:y, Float:z;
				
				GetPlayerPos(playerid, x, y, z);
				CreateExplosion(x, y, z, 0, 5.0);
				
				SetPlayerHealth(playerid, 0);
			}
			
		}
	}
	
	return 1;
}
Reply
#6

YOUR A GENIOUS IT COMPILES FINE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)