Floats, problems, etc - 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)
+--- Thread: Floats, problems, etc (
/showthread.php?tid=657253)
Floats, problems, etc -
IdonTmiss - 03.08.2018
Well I have this piece of code and it won't work ( that's why I'm posting this lol )
pawn Код:
hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
//if(PRESSED(KEY_CTRL_BACK))
if(newkeys == KEY_CTRL_BACK)
{
new Float:Xa, Float:Ya, Float:Za;
GetVehiclePos(AdminVeh[playerid], Xa, Ya, Za);
va_print("%f player poz", GetPlayerPos(playerid, X_C, Y_C, Z_C));
va_print("%f veh poz", GetVehiclePos(AdminVozilo[playerid], Xa, Ya, Za));
if(!IsPlayerInAnyVehicle(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 5, Xa, Ya, Za)) return SendClientMessage(playerid, -1, "nonoono");
else {
if(Uzo[playerid] == 1) {
if(GetVehicleModel(GetClosestVehicle(playerid) != 408)) return SCM(playerid, -1, "nahhh");
if(Kontova[playerid] == 15) return SCM(playerid, -1, "PRC");
RemovePlayerAttachedObject(playerid, djubr[playerid]);
SCM(playerid, -1, "Idite do drugog kontejnera");
if(Kontova[playerid] == -1) return Kontova[playerid] = 1;
Uzo[playerid] = 0;
Kontova[playerid] ++;
}
}
}
}
return 1;
}
So va_print prints out "0.00000" for both
PHP код:
if(!IsPlayerInRangeOfPoint(playerid, 5, Xa, Ya, Za)) return SendClientMessage(playerid, -1, "nonoono"); // this wont work
Re: Floats, problems, etc -
IdonTmiss - 03.08.2018
Quote:
Originally Posted by ******
What do you think GetPlayerPos returns?
|
U mean like how much floats or ( %f, %f, %f or %f ) ?
[ it returns player's pos ofc xd ]
Re: Floats, problems, etc -
Banditul18 - 03.08.2018
https://sampwiki.blast.hk/wiki/GetPlayerPos
https://sampwiki.blast.hk/wiki/GetVehiclePos
Not even close. The position is passed by reference not by return. Only return the succes value