Variable saving problem (I think) - 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: Variable saving problem (I think) (
/showthread.php?tid=383492)
Variable saving problem (I think) -
printer - 07.10.2012
Hello, this is the code:
1.
pawn Код:
CMD:setfare(playerid, params[])
{
if(PlayerInfo[playerid][pJob] !=6)
return SendClientMessage(playerid,C_RED,"You're not a taxi driver.");
new
fare
;
if(sscanf(params,"i",fare))
return SendClientMessage(playerid,C_NICE,"[Usage] {FFFFFF}/setfare [fare]");
if(fare < 1) return 1;
SendFormat(playerid,C_NICE,"You have set your fare to $%i per second.",fare);
PlayerInfo[playerid][TaxiFare] = fare;
return 1;
}
2. OnPlayerEnterVehicle:
pawn Код:
if(VehicleData[vehicleid][vModel] == 420 && ispassenger && !PlayerInfo[playerid][Aduty])
{
if(PlayerInfo[VehicleDriver(vehicleid)][TaxiFare] < 1)
return AC_SetPlayerPos(playerid, pos[0], pos[1], pos[2] + 5), SendClientMessage(playerid,C_RED,"Taxi doors are still closed.");
SendFormat(playerid,C_YELLOW,"[Taxi] {FFFFFF}This taxi driver charges $%i per second.",PlayerInfo[VehicleDriver(vehicleid)][TaxiFare]);
}
3. VehicleDriver stock:
pawn Код:
stock VehicleDriver(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER) return i;
}
return 1;
}
The problem is that it says: "The taxi driver charges $0" all the time, even when I set /setfare 5.