Help to fix that. -
budelis - 11.07.2011
Hello.I need some help,with that:
if(model != 481 && model != 510 && model != 509)//If not bikes
{
if(vehicleDB[vehicleid][gas] > 2)//if vehicle have more than 2 gas
{
SetPVarInt(vehicleid, "Gas", vehicleDB[vehicleid][prav]/10000);//Set pvar by get player vehicle distance:
if(vehicleDB[vehicleid][prav]/10000+0.1 >= GetPVarInt(vehicleid, "Gas"))//if all distance is 100 metres more than pvar player will lose 1 gas
{
vehicleDB[vehicleid][gas] -=0.1;// take from player 0.1 gas.
vehicleDB[vehicleid][prav]/10000 (with this i get all player run with vehicle distance).
And i get warning in this line:
C:\Documents and Settings\Owner\Desktop\SAMP Serveris\gamemodes\SF.pwn(4717) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
SetPVarInt(vehicleid, "Benzinas", vehicleDB[vehicleid][prav]/10000);
But for example what i want to do is that:I want if player run with vehicle 100 metres he lost 1 gas 200 metras 1 gas,and t.t.t......And i set a timer for 1 sec,who check if player 100 metres run with vehicle more than previously distance he lost 1 gas.But now please try fix my error,and please make script that what i sad.
Re: Help to fix that. -
dowster - 11.07.2011
hmm.. im not so good with using distance formulas but i would guess it would be an OnVehicleUpdate type thing, again i'll get back to you after ive had some rest.
Re: Help to fix that. -
budelis - 11.07.2011
but why i get this error:
C:\Documents and Settings\Owner\Desktop\SAMP Serveris\gamemodes\SF.pwn(4717) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
in this line:
SetPVarInt(vehicleid, "Gas", vehicleDB[vehicleid][prav]/10000);
Re: Help to fix that. -
Patrik356b - 11.07.2011
is prav defined as a float or something else ? - it seems so to due the error
Re: Help to fix that. -
dowster - 11.07.2011
which is line 213?
sorry i didnt see that part of the post
Re: Help to fix that. -
alpha500delta - 11.07.2011
It's a
warning not an
error.
Also you could try the calculation first and then putting the result in the code, like this:
pawn Код:
new something = vehicleDB[vehicleid][prav] / 10000;
SetPVarInt(vehicleid, "Gas", something);
I don't know lol...
Re: Help to fix that. -
budelis - 11.07.2011
Yes prav is float:
i try that:
new something = vehicleDB[vehicleid][prav] / 10000;
SetPVarInt(vehicleid, "Gas", something);
But I again get error in this line:
new something = vehicleDB[vehicleid][prav] / 10000;
Tag mismach
Re: Help to fix that. -
Patrik356b - 11.07.2011
Sorry, i misread warning for error, but how is prav defined ?
Re: Help to fix that. -
budelis - 11.07.2011
enum vitem{
Float:gas,
bool:locked,
bool:Uzrakinta,
bool

arduodama,
lastuser,
Float:lastpos[4],
owner_name[MAX_PLAYER_NAME],
Float

rav
}
There how you see is prav(prav means distance).
here i use prav:
new Float:ST[4];
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;
vehicleDB[vehicleid][prav] += ST[3];
prav + vehicle speed.
and then to get distance i will divide prav from 10000
vehicleDB[vehicleid][prav]/10000
Re: Help to fix that. -
Patrik356b - 11.07.2011
it's a float, not an int, hence "SetPVarInt(vehicleid, "Benzinas", vehicleDB[vehicleid][prav]/10000);" is wrong, change it to:
Код:
SetPVarFloat(vehicleid, "Benzinas", vehicleDB[vehicleid][prav]/10000);