[HELP] Timer :/
#1

Hey i use Ladmin 4v2 and i made /car command so all can use it, now i wanted to make a /acar command that only works for admins and, success! Admins can now spawn how many cars they want. But, my friend asked if i could make a 5 minute timer, and theres the problem.

Heres my code:
Код:
4336dcmd_acar(playerid,params[]){
4337  if(PlayerInfo[playerid][Level] >= 5 && PlayerInfo[playerid][LoggedIn] == 1) {
4338	  new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
4339	  if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /acar [VehicleID/VehicleName] [colour1] [colour2]");
4340		new car, colour1, colour2;
4341  		if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
4342		if(car < 400 || car > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
4343		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
4344		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
4345		new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1;	GetPlayerPos(playerid, X,Y,Z);4346	GetPlayerFacingAngle(playerid,Angle);  int1 = GetPlayerInterior(playerid);
4347		LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
4348		PlayerInfo[playerid][pCar] = LVehicleID;
4349		SetTimer(CarDeleter,300000,1);
4350  } else return SendClientMessage(playerid,red,"You are not high enough level to use this command!");
4351  return 1;
4352}
And heres the error:
Код:
C:\Documents and Settings\Administrator\Desktop\Server\filterscripts\ladmin.pwn(4349) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Learn how to use SetTimer - https://sampwiki.blast.hk/wiki/SetTimer
Reply
#3

Maybe you would want this too
Код:
forward CarDeleter(vehicleid);
public CarDeleter(vehicleid)
{
  for(new i=0;i<MAX_PLAYERS;i++) {
    new Float:X,Float:Y,Float:Z;
  	if(IsPlayerInVehicle(i, vehicleid)) {
  	  RemovePlayerFromVehicle(i);
  	  GetPlayerPos(i,X,Y,Z);
    	SetPlayerPos(i,X,Y+3,Z);
	  }
	  SetVehicleParamsForPlayer(vehicleid,i,0,1);
	}
  SetTimerEx("VehRes",1500,0,"i",vehicleid);
}

forward VehRes(vehicleid);
public VehRes(vehicleid)
{
  DestroyVehicle(vehicleid);
}
Reply
#4

Quote:
Originally Posted by Don Correlli
Learn how to use SetTimer - https://sampwiki.blast.hk/wiki/SetTimer
Yes but what am i doing wrong?
Reply
#5

Quote:
Originally Posted by bajskorv123
Yes but what am i doing wrong?
Check the example in the link i gave you and compare it with your SetTimer.
Reply
#6

Thanks hhhh i forgot to put " before and after cardeleter tyvm hhhh
Reply
#7

I'm glad you have noticed it. You're welcome.
Reply
#8

Admin may lock topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)