Simple /fill - 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: Simple /fill (
/showthread.php?tid=523092)
Simple /fill -
Akcent_Voltaj - 30.06.2014
hi how can I make it so its like this /fill 10 and fills 10 liters.. plz help.
PHP код:
if(strcmp(cmd, "/fill", true) == 0)
{
if(!IsAtGasStation(playerid))
{
return SendClientMessage(playerid, COLOR_GREEN, "Nu esti la Benzinarie!");
}
if(!IsPlayerInAnyVehicle(playerid))
{
return SendClientMessage(playerid, COLOR_RED, "Nu esti in vehicul!");
}
if(engineOn[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|| Trebuie sa ai motorul oprit! ||");
return 1;
}
if(IsRefilling[playerid])
{
return SendClientMessage(playerid, COLOR_RED, "Faci plinul..");
}
if(GetPlayerCash(playerid) < 150)
{
return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Nu ai destui bani!");
}
new vehicleid = GetPlayerVehicleID(playerid);
if(VehicleFuel[vehicleid] == 1000)//strange lets update com e on svr!
{
return SendClientMessage(playerid, COLOR_YELLOW, "Vehicolul este plin de combustibil"); // i have 99.9 and message appears.
}
GivePlayerCash(playerid,-150);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
RefillingTimer[playerid] = SetTimerEx("Refilling", 100, true, "iiiiiiiii", playerid, vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
IsRanOutOfFuel[vehicleid] = true;
IsRefilling[playerid] = true;
return 1;
}
Re: Simple /fill -
GeekSiMo - 30.06.2014
You need to use sscanf plugin !
Re: Simple /fill -
Akcent_Voltaj - 30.06.2014
I type /fill and fills up .. I did /fill 10 to fill 10L
PHP код:
if(strcmp(cmd, "/fill", true) == 0) //this
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{00A1FF}USAGE{FFFFFF}: /fill [ammount]");
return 1;
}
new fuel;
new vehicleid = GetPlayerVehicleID(playerid);
fuel = strval(tmp); // this?
if(fuel>1000)return SendClientMessage(playerid,COLOR_RED,"Nu poti alimenta vehicolul!");//this line was needed
if(!IsAtGasStation(playerid))
{
return SendClientMessage(playerid, -1, "Nu esti la Benzinarie!");
}
if(!IsPlayerInAnyVehicle(playerid))
{
return SendClientMessage(playerid, -1, "Nu esti in vehicul!");
}
if(engineOn[playerid] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|| Trebuie sa ai motorul oprit! ||");
return 1;
}
if(IsRefilling[playerid])
{
return SendClientMessage(playerid, -1, "Faci plinul..");
}
if(GetPlayerCash(playerid) < 120)
{
return SendClientMessage(playerid, -1, "Nu ai destui bani!");
}
if(VehicleFuel[vehicleid] == 1000)//strange lets update com e on svr!
{
return SendClientMessage(playerid, -1, "Vehicolul este plin de combustibil"); // i have 99.9 and message appears.
}
GivePlayerCash(playerid,-50);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
TextDrawSetString(Text:Values[playerid][2], "Refilling...");
RefillingTimer[playerid] = SetTimerEx("Refilling", 100, true, "iiiiiiiii", playerid, vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
IsRanOutOfFuel[vehicleid] = true;
IsRefilling[playerid] = true;
return 1;
}