Steal Fuel? - 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: Steal Fuel? (
/showthread.php?tid=185309)
Steal Fuel? -
<Weponz> - 24.10.2010
Ok i need a code for stealing fuel..
Im thinking a IsPlayerInArea and OnPlayerCommandText not sure how to save the fuel of hold it etc and a Timer im guessing to refill it<Can anyone tell me what i need
Exactly wat i need: Anyone can go upto a Tank and type /stealfuel,each tank has random ammounts,After 2 IRL mins it refills.
Thanks in advance.
Re: Steal Fuel? -
Retardedwolf - 24.10.2010
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/Random
Re: Steal Fuel? -
Whizion - 24.10.2010
You want to steal the fuel from the gas station or a car?
If from te gas station just use IsPlayerInRangeOfPoint(playerid,5.0,x,y,z); x,y,z = coordinates of your gas station.
If from te car use this:
pawn Код:
cmd(stealfuel, playerid, params[])
{
if(IsPlayerConnected(playerid))
{
for(new i = 1; i < MAX_VEHICLES; i++)
{
if(GetDistanceFromPlayerToVehicle(playerid, i))
{
if(VariableInWhichYouStoreCarFuel[i] > 0)
{
SetPVarInt(playerid,"StoledFuel",VariableInWhichYouStoreCarFuel[i]);
SendClientMessage(playerid,0xFFFFFFAA,"You stoled fuel!");
}
{
SendClientMessage(playerid,0xFFFFFFAA,"This vehicle hasn't got any fuel left!");
}
break;
}
}
}
return 1;
}
You will need zcmd to use that command, i forgot how to do it with OnPlayerCommandText and strval...
pawn Код:
stock GetDistanceFromPlayerToVehicle(playerid, vehicleid)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetVehiclePos(vehicleid,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
Re: Steal Fuel? -
<Weponz> - 24.10.2010
Quote:
Originally Posted by Whizion
You want to steal the fuel from the gas station or a car?
|
A Object Or Even A Area And I Can Just Place The Object There..
EDIT:
Quote:
Originally Posted by Whizion
You will need zcmd to use that command, i forgot how to do it with OnPlayerCommandText and strval...
|
Dude thats exactly how i script...IDK DCMD & ZCMD and dat s**t :S