SA-MP Forums Archive
Start count - 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: Start count (/showthread.php?tid=294229)



Start count - Speed - 31.10.2011

How to make a public command that will count how long you are on some place...

Example: i type /now, and count start i teleport to position, and i have a marker i enter the marker and i count stop and i get message how long it takes...

p.s i now how to do CMD, and evrything I just need some function to start count... and how to stop it


Re: Start count - boyan96 - 31.10.2011

PHP код:
if(strcmp(cmdtext,"/count",true) == 0) {
   new 
pName[30];
   new 
string[256];
   if (
== false)
   {
   
true;
   
GetPlayerName(playeridpName30);
   
format(string280"*** %s started count."pName);
   
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
   for(new 
iMAX_PLAYERSi++) {
   
GameTextForPlayer(i"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,3);
   
GetPlayerPos(i,X,Y,Z);
   }
   
SetTimer("count2",1000,0);
   
SetTimer("count1",2000,0);
   
SetTimer("countgo",3000,0);
   
SetTimer("stop",6000,0);
}
   else 
SendClientMessage(playerid0xFF9900AA"Its allready started!");
   return 
1;
   }
   return 
0;
}
////////////////////////////////////////////////////////////////////////////////
public count2()
{
   for(new 
iMAX_PLAYERSi++) {
   
GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 2 ~g~-",1000,3);
   
GetPlayerPos(i,X,Y,Z);
   }
}
////////////////////////////////////////////////////////////////////////////////
public count1()
{
   for(new 
iMAX_PLAYERSi++) {
   
GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 1 ~g~-",1000,3);
   
GetPlayerPos(i,X,Y,Z);
   }
}
////////////////////////////////////////////////////////////////////////////////
public countgo()
{
   for(new 
iMAX_PLAYERSi++) {
   
GetPlayerPos(i,X,Y,Z);
   
GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~]~g~-~g~START~g~-~y~]~g~-",1000,3);
   
PlayerPlaySound(i,1057,X,Y,Z);
   }
}
public 
stop()
{
   
false;

if i was helpfull can you add me reputation


Re: Start count - TomTroX - 31.10.2011

pawn Код:
#include <a_samp>
#include <zcmd>

#define COLOR_LIGHTBLUE -1

new string[128];
new countdown;
new TimerCount;

CMD:count(playerid, params[])
{
    new
        pName[30]
    ;
   
    if (countdown != 0)
        return SendClientMessage(playerid, 0xFF9900AA, "Its allready started!");

    countdown = 3;
   
    GetPlayerName(playerid, pName, 30);
    format(string, 280, "*** %s started count.", pName);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
   
    GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,3);

    TimerCount = SetTimer("Count2", 1000, true);
    return 1;
}

forward Count2();
public Count2()
{
    countdown--;
   
    if(countdown != 0)
        format(string, sizeof string, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ %d ~g~-", countdown);
    else
        string = "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~]~g~-~g~START~g~-~y~]~g~-";
    GameTextForAll(string,1000,3);
   
    if(countdown <= 0)
    {
        KillTimer(TimerCount);
        countdown = 0;
    }
    return 1;
}



Re: Start count - Speed - 31.10.2011

I dont think about that i think something about Race System, when race start, timer starts, when player finish race he get score...(finish time)