Help with this script please - 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: Help with this script please (
/showthread.php?tid=389586)
Help with this script please -
razerch0 - 02.11.2012
pawn Код:
//=====INCLUDES=====//
#include <a_samp>
//===================DEFINES====================//
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//====================FORWARDS=================//
forward DstVeh(playerid);
//=============================================//
#if defined FILTERSCRIPT
public OnPlayerConnect(playerid)
{
SetTimerEx("DstVeh",30000,true,"i",playerid);
return 1;
}
public DstVeh(playerid)
{
new vh=CreateVehicle(400,0.0,0.0,0.0,0.0,-1,-1,-1);
DestroyVehicle(vh);
new p[MAX_VEHICLES];
for(new v = 0; v < vh; v++){
p[v]=0;
for(new i = 0; i < GetMaxPlayers(); i++){
if(IsPlayerInVehicle(i,v)) p[v]=1;
}
if(p[v]==0) DestroyVehicle(v);
}
return 1;
}
#endif
Where is the problem in this script for destroy the vehicles ?
Re: Help with this script please -
adsy - 02.11.2012
your script destroys all vehicles up to a set vehicle number, am i reading this correctly?
Re: Help with this script please -
mamorunl - 02.11.2012
Why are you loading it for every player? If you have 15 players online you are loading the DstVeh 15 times and you aren't even using the playerid variable so you are wasting your resources and destroying vehicles every 30 minutes when a player joins the server (and, so it seems, never destroy that so it just keeps on adding up and up until you have this timer run every minute or even second and never able to enter a vehicle because it keeps respawning)
Re: Help with this script please -
razerch0 - 02.11.2012
Just give the corrected script! Okay ?! ;d