Private car help -
farris - 07.09.2010
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.
Re: Private car help -
JamesC - 07.09.2010
Код:
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.
Re: Private car help -
farris - 07.09.2010
testing now
Re: Private car help -
farris - 07.09.2010
umm can ye add the par that defines the name of car which would be something like :
{
if(vehicleid == xander)
{
Re: Private car help -
JamesC - 07.09.2010
Код:
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;
}
Re: Private car help -
farris - 07.09.2010
YOUR A GENIOUS IT COMPILES FINE