warning 209: function "GetPlayerGas" should return a value
#1

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
Reply
#2

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

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.
Reply
#4

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

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
Reply
#6

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?
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)