SA-MP Forums Archive
warning 209: function "GetPlayerGas" should return a value - 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: warning 209: function "GetPlayerGas" should return a value (/showthread.php?tid=164792)



warning 209: function "GetPlayerGas" should return a value - DiddyBop - 02.08.2010

Not sure what i did wrong but im making a custom function for my server. Here is code

pawn Код:
stock GetPlayerGas(playerid)
{
    amount = GetPVarInt(playerid, "gas");
    return amount;
}
And im using it in a string, such as.


pawn Код:
format(string, sizeof(string), "You have %d Gallons of gas left.", GetPlayerSP(splayer));
(Gas is used as an example for somthing else, But it works the same way)

Again, its giving warning warning 209: function "GetPlayerGas" should return a value


Re: warning 209: function "GetPlayerGas" should return a value - Daren_Jacobson - 02.08.2010

pawn Код:
stock GetPlayerGas(playerid)
{
    new amount;
    amount = GetPVarInt(playerid, "gas");
    return amount;
}



Re: warning 209: function "GetPlayerGas" should return a value - DiddyBop - 02.08.2010

i tired that b4, then just did yours and it worked, i think what i did with setting "new amount;" Is i put it in the wrong include.

Thanks.


Re: warning 209: function "GetPlayerGas" should return a value - Jefff - 02.08.2010

simply
pawn Код:
stock GetPlayerGas(playerid)
{
    return GetPVarInt(playerid, "gas");
}



Re: warning 209: function "GetPlayerGas" should return a value - speediekiller2 - 09.08.2010

how can i fix warning 209 in this script what i must to do.



public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/repair", cmdtext))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
return 1;
}
}
#endif


Re: warning 209: function "GetPlayerGas" should return a value - Hiddos - 09.08.2010

Quote:
Originally Posted by speediekiller2
Посмотреть сообщение
how can i fix warning 209 in this script what i must to do.



public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/repair", cmdtext))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
return 1;
}
}
#endif
Make your own topic.


On-topic: Tried what Jefff said?


Re: warning 209: function "GetPlayerGas" should return a value - r0b - 09.08.2010

pawn Код:
stock GetPlayerGas(playerid) return GetPVarInt(playerid, "gas");
I think this will work, too.