help? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help? (
/showthread.php?tid=226013)
help? -
Black_Sun1 - 14.02.2011
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!
Re: help? -
Ash. - 14.02.2011
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;
}
Re: help? -
Black_Sun1 - 14.02.2011
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?
Re: help? -
Black_Sun1 - 15.02.2011
somebody knows?
Re: help? -
Ash. - 15.02.2011
Ensure you return 1 in OnPlayerEnterVehicle (callback)
Re: help? -
Black_Sun1 - 15.02.2011
Quote:
Originally Posted by funky1234
Ensure you return 1 in OnPlayerEnterVehicle (callback)
|
it is
other suggestions?
Re: help? -
Ash. - 15.02.2011
Show us OnPlayerEnterVehicle
Re: help? -
Black_Sun1 - 15.02.2011
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;
}
Re: help? -
Black_Sun1 - 15.02.2011
somebody? i need it quick!
Re: help? -
Black_Sun1 - 16.02.2011
oh come on...... i need it rly.....