26.07.2012, 13:23
How can I do filterscript a command can be used for example in 30 minutes? What is the code?
public OnGameModeInit()
{
SetTimer("action", 3000000, false);
}
YCMD:takejob(playerid,params[],help) { #pragma unused help #pragma unused params new id = GetJobID(playerid); if(id == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no any job."); if(P_Data[playerid][pJob] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You already have job."); SendFormatMSG(playerid,-1,"Now your job is {E0941B}%s",Job[id][Name]); P_Data[playerid][pJob] = id; return 1; } How to create this for 30 minutes?
new bool:TakeJobTimer[MAX_PLAYERS];
forward JobTimer( playerid );
YCMD:takejob(playerid,params[],help)
{
if(!TakeJobTimer)
{
#pragma unused help
#pragma unused params
new id = GetJobID(playerid);
if(id == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no any job.");
if( P_Data[playerid][pJob] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You already have job.");
SendFormatMSG( playerid, -1, "Now your job is {E0941B}%s", Job[id][Name] );
P_Data[playerid][pJob] = id;
TakeJobTimer = true;
SetTimer( "JobTimer", 3000000, false );
}else return SendClientMessage(playerid, -1, "You must wait 30 minutes before doing another job again!");
return 1;
}
public JobTimer(playerid)
{
TakeJobTimer = false;
return 1;
}
C:\Users\ники\Desktop\IG_Job_Maker.pwn(489) : error 033: array must be indexed (variable "TakeJobTimer") C:\Users\ники\Desktop\IG_Job_Maker.pwn(506) : error 033: array must be indexed (variable "TakeJobTimer") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.
new bool:TakeJobTimer;
forward JobTimer( playerid );
YCMD:takejob(playerid,params[],help)
{
if(!TakeJobTimer)
{
#pragma unused help
#pragma unused params
new id = GetJobID(playerid);
if(id == -1) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"There is no any job.");
if( P_Data[playerid][pJob] != 0) return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"You already have job.");
SendFormatMSG( playerid, -1, "Now your job is {E0941B}%s", Job[id][Name] );
P_Data[playerid][pJob] = id;
TakeJobTimer = true;
SetTimer( "JobTimer", 3000000, false );
}else return SendClientMessage(playerid, -1, "You must wait 30 minutes before doing another job again!");
return 1;
}
public JobTimer(playerid)
{
TakeJobTimer = false;
return 1;
}