Need a little help here - 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: Need a little help here (
/showthread.php?tid=145402)
Need a little help here -
[XST]O_x - 02.05.2010
Hey
Just made a little noobie thing that if you press the action key you spawn an infernus,
and i have couple of questions
1.How can i make something that if i pressed ctrl once and spawned a car i won't be able to spawn another one
for an amount of time?cuz ppl just tapping ctrl and it lags the server and spawns tons of cars O.o
2.And i have another problem,everytime if i face north the car spawns fine infront of me,and if i face south its
spawning behind me. anyone knows how to solve it?
Re: Need a little help here -
[XST]O_x - 02.05.2010
Sorry,bump.
Re: Need a little help here -
Miguel - 02.05.2010
Quote:
Originally Posted by O_x
1.How can i make something that if i pressed ctrl once and spawned a car i won't be able to spawn another one
for an amount of time?cuz ppl just tapping ctrl and it lags the server and spawns tons of cars O.o
|
pawn Код:
YOURFUNCTIONTOSPAWNVEHICLES() // e.g OnPlayerKeyStateChange
{
if(GetTickCount() < tick) return SendClientMessage(playerid, COLOR, "You'll need to wait to spawn another vehicle!");
// your stuff to spawn vehicle...
tick = GetTickCount() + 10000; // change 10000 for the amount of time in ms.
return 1;
}
Re: Need a little help here -
[XST]O_x - 02.05.2010
Thanks guys
If anyone knows the answer to the second one i'll be glad if you'll post it here ^^
thanks
Edit:
Here is the code(if it helps..)
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
{
new Float:x, Float:y, Float:z;
new Abc;
new Float:Angle;
Abc = GetPlayerFacingAngle(playerid, Angle);
GetPlayerPos(playerid,x,y,z);
if(GetTickCount() < tick) return SendClientMessage(playerid, COLOR_RED, "You're gonna need to wait 30 seconds to spawn another vehicle.");
CreateVehicle(411,x,y+6.13,z,Abc+90,0,1,300);
tick = GetTickCount() + 30000;
}
return 1;
}
btw it works thanks alot
Re: Need a little help here -
Torran - 02.05.2010
2. GetXYInfrontOfPlayer
Search it, Its on here somewhere
Re: Need a little help here -
[XST]O_x - 02.05.2010
Quote:
Originally Posted by Joe Torran C
2. GetXYInfrontOfPlayer
Search it, Its on here somewhere
|
Ok,i found it
https://sampwiki.blast.hk/wiki/Stocks#Re...ultiple_values
Thanks i'll try it out