#1

I'm always getting this error while compiling:
Код:
error 001: expected token: "-identifier-", but found "-rational value-"
in this scipt
Код:
stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid)
{
	if(IsPlayerConnected(playerid))
	{
	    new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z;
	    GetPlayerPos(playerid,PX,PY,PZ);
	    GetVehiclePos(vehicleid, X,Y,Z);
	    new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
	    if(Distance <= radi*radi)
	    {
	        return 1;
	    }
	}
	return 0;
}
I'm using that script for my trunk system, but now, it failed...
Help, please!
Reply
#2

I have changed your script quite a bit, but this is what i use and it works.

pawn Код:
stock CheckPlayerDistanceToVehicle(Float:rad, playerid, vehicleid)
{
    new Float:vx, Float:vy, Float:vz;
    GetVehiclePos(vehicleid, vx, vy, vz);
    if(IsPlayerInRangeOfPoint(playerid, rad, vx, vy, vz)) return 1;
    return 0;
}
Reply
#3

Well thanks it worked, and now i can run my script again... But now i have a new problem! Every time when i enter any command, it says SERVER: Unknown Command and doesn't even execute the command. What should i do? What could be the reason?
Reply
#4

somebody knows?
Reply
#5

Ensure you return 1 in OnPlayerEnterVehicle (callback)
Reply
#6

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Ensure you return 1 in OnPlayerEnterVehicle (callback)
it is other suggestions?
Reply
#7

Show us OnPlayerEnterVehicle
Reply
#8

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Show us OnPlayerEnterVehicle
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[128];
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(Spectate[i] != 255)
            {
                PlayerSpectateVehicle(i,vehicleid);
            }
        }
    }
    if(IsAGSFCar(vehicleid) && IsPlayerAMemberOf(playerid) != 1)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the Grove Gang!");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
        else if(IsABCar(vehicleid) && IsPlayerAMemberOf(playerid) != 2)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the Ballas Gang");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
        else if(IsALCNCar(vehicleid) && IsPlayerAMemberOf(playerid) != 3)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the La Cosa Nostra Mafia");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
        else if(IsAYCar(vehicleid) && IsPlayerAMemberOf(playerid) != 4)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the Yakuza Mafia");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
        else if(IsAAZTCar(vehicleid) && IsPlayerAMemberOf(playerid) != 5)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the Aztecas Gang!");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
        else if(IsAVAGCar(vehicleid) && IsPlayerAMemberOf(playerid) != 6)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the Vagos Gang!");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
        else if(IsAHCar(vehicleid) && IsPlayerAMemberOf(playerid) != 7)
        {
            format(string,sizeof(string),"You can't drive this vehicle because you are not a member of the Hitmen Agency");
            SendClientMessage(playerid, COLOR_LIGHTRED, string);
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#9

somebody? i need it quick!
Reply
#10

oh come on...... i need it rly.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)