Help with timer
#1

Hello, I created /arrest (or /ar whatever..)

And when i /arrest someone he sent to jail, I need jail timer, let's say.. ahuymm 200 seconds

And i tried to ****** lol.

oh and make it sortof a tutorial so i will learn from it .
Reply
#2

https://sampwiki.blast.hk/wiki/SetTimerEx
Example:
pawn Код:
CMD:arrest(playerid,params[])
{
    new time;
    SetTimerEx("UnjailTimer",time*1000,"i",playerid);//Note use time*1000 only if you're using per seconds if you want only 200 seconds use 200000 instead of time*1000
    return 1;
}

//Later usage
forward UnjailTime(playerid);
public UnjailTime(playerid)
{
    //Unjail him by using SpawnPlayer(playerid);, however you can either  set his postion
}
Reply
#3

--REMOVD--

So no one will copy my cmd.
Reply
#4

pawn Код:
CMD:arrest(playerid,params[])
{
  new targetid, str[512];
  if(IsPlayerPolice[playerid] < 1) return SendClientMessage(playerid,-1,"{ff0000}This command only for cops");
  if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1,"USAGE: /arrest [Part of Name/Player ID]");
  if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"ERROR: This player is not connected!");
  if(playerid == 0) return SendClientMessage(playerid, 0xFFFFFFF, "ERROR: You can't arrest yo self lmao");
  new target[MAX_PLAYER_NAME];
  GetPlayerName(targetid, target, sizeof(target));
  format(str, sizeof(str), "{ff0000}You have arrested %s",target);
  SendClientMessage(playerid, 0xE01B1B, str);
  GameTextForPlayer(playerid, "ARRESTED",5000,2);
  SendClientMessageToAll(-1, "%s Has been sent to jail");
  SetPlayerInterior(playerid, 6);
  ResetPlayerWeapons(playerid);
  SetTimerEx("UnjailTimer",1000,0,"i",targetid);
  return 1;
}
see if it works there
Reply
#5

warning 203: symbol is never used: "time"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#6

Then you haven't used a symbol named time, just remove that.

You know that when errors like this come up.. They are pretty self explanatory.
Reply
#7

ty lol
Reply
#8

Quote:
Originally Posted by YanLanger
Посмотреть сообщение
warning 203: symbol is never used: "time"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
deleted time

pawn Код:
new targetid, str[512];
so it is no time
Reply
#9

When the player released? 200 seconds ye ?
Reply
#10

Quote:
Originally Posted by YanLanger
Посмотреть сообщение
When the player released? 200 seconds ye ?
you want the player is released in 200 second?

or want to stay in jail 200 seconds?

switch to the second you want
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)