Timer problem - 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: Timer problem (
/showthread.php?tid=483456)
Timer problem -
aboa - 26.12.2013
I want to create a timer for this public:
pawn Код:
forward matspick(playerid);
public matspick(playerid)
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if (PlayerToPoint(1.0,playerid,DropInfo[i][dx],DropInfo[i][dy],DropInfo[i][dz]))
{
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][dWorld])
{
DestroyObject(DropObject[i]);
DropInfo[i][dx] = 0.0;
DropInfo[i][dy] = 0.0;
DropInfo[i][dz] = 0.0;
if(DropInfo[i][dType] == 4) // Crack
{
new string[256];
format(string,sizeof(string),"* %s picks up %d materials.",Name(playerid),DropInfo[i][dAmount]);
ProxDetector(30.0,playerid,string,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
PlayerInfo[playerid][pMats] += DropInfo[i][dAmount][0];
DropInfo[i][dAmount][0] = 0;
DropInfo[i][dAmount][1] = 0;
DropInfo[i][dType] = 0;
}
}
}
}
}
Re: Timer problem -
Aliassassin123456 - 26.12.2013
Do not Create double topics
i told you, you must show me Where you define DropInfo?
Re: Timer problem -
aboa - 26.12.2013
I fixed the old problem and I need to create a timer
Re: Timer problem -
Aliassassin123456 - 26.12.2013
pawn Код:
static playertimer[MAX_PLAYERS];
#define TimerInterval 5000 //Type your interval here (MS)
#define reapiting 1 //You want to timer repeat? use 1 else 0
public OnPlayerConnect(playerid)
{
playertimer[playerid] = SetTimerEx("matspick", TimerInterval, reapiting, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(playertimer[playerid]);
return 1;
}
Also see here:
SetTimerEx
Re: Timer problem -
aboa - 26.12.2013
pawn Код:
enum dInfo
{
dType,
dAmount[2],
Float:dx,
Float:dy,
Float:dz,
dWorld,
dPlayerName[MAX_PLAYER_NAME],
};
new DropInfo[3000][dInfo];
new DropObject[3000];
Re: Timer problem -
aboa - 26.12.2013
I want to but the timer in command '/grab' after animation