How do i convert this work in ZCMD?
#1

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp(cmdtext,"/count",true) == 0) {
   new pName[30];
   new string[256];
   if (a == false)
   {
   a = true;
   GetPlayerName(playerid, pName, 30);
   format(string, 280, "[INFO]:%s je pokrenuo odbrojavanje.", pName);
   SendClientMessageToAll(COLOR_LIGHTBLUE, string);
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,4);
   GetPlayerPos(i,X,Y,Z);
   PlayerPlaySound(i,1056,X,Y,Z);
   }
   SetTimer("count2",1000,0);
   SetTimer("count1",2000,0);
   SetTimer("countgo",3000,0);
   SetTimer("stop",6000,0);

}
   else SendClientMessage(playerid, 0xFF9900AA, "[INFO]:Vec je pokrenuto.");
   return 1;
   }
   return 0;
}
////////////////////////////////////////////////////////////////////////////////
public count2()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 2 ~g~-",1000,4);
   GetPlayerPos(i,X,Y,Z);
   PlayerPlaySound(i,1056,X,Y,Z);
   }
}
////////////////////////////////////////////////////////////////////////////////
public count1()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 1 ~g~-",1000,4);
   GetPlayerPos(i,X,Y,Z);
   PlayerPlaySound(i,1056,X,Y,Z);
   }
}
////////////////////////////////////////////////////////////////////////////////
public countgo()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GetPlayerPos(i,X,Y,Z);
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~]~g~-~g~GO GO GO~g~-~y~]~g~-",1000,4);
   PlayerPlaySound(i,1057,X,Y,Z);
   }
}
public stop()
{
   a = false;
}
Reply
#2

Код:
COMMAND:count(playerid, params[])
{
 new pName[30];
   new string[256];
   if (a == false)
   {
   a = true;
   GetPlayerName(playerid, pName, 30);
   format(string, 280, "[INFO]:%s je pokrenuo odbrojavanje.", pName);
   SendClientMessageToAll(COLOR_LIGHTBLUE, string);
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,4);
   GetPlayerPos(i,X,Y,Z);
   PlayerPlaySound(i,1056,X,Y,Z);
   }
   SetTimer("count2",1000,0);
   SetTimer("count1",2000,0);
   SetTimer("countgo",3000,0);
   SetTimer("stop",6000,0);

else SendClientMessage(playerid, 0xFF9900AA, "[INFO]:Vec je pokrenuto.");
   return 1;

}
  

////////////////////////////////////////////////////////////////////////////////
public count2()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 2 ~g~-",1000,4);
   GetPlayerPos(i,X,Y,Z);
   PlayerPlaySound(i,1056,X,Y,Z);
   }
}
////////////////////////////////////////////////////////////////////////////////
public count1()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 1 ~g~-",1000,4);
   GetPlayerPos(i,X,Y,Z);
   PlayerPlaySound(i,1056,X,Y,Z);
   }
}
////////////////////////////////////////////////////////////////////////////////
public countgo()
{
   for(new i; i < MAX_PLAYERS; i++) {
   GetPlayerPos(i,X,Y,Z);
   GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~]~g~-~g~GO GO GO~g~-~y~]~g~-",1000,4);
   PlayerPlaySound(i,1057,X,Y,Z);
   }
}
public stop()
{
   a = false;
}
if any error paste here and #include<zcmd> , include
Reply
#3

just copy the code of this command and paste it outof any callback (at the end of your script), but instead
pawn Код:
if(strcmp(cmdtext, "/count" ... )
Use
pawn Код:
CMD:count(playerid, params[])
{
 //yourcode goes here
}
Make sure you have
pawn Код:
#include <zcmd>
in your includes
Reply
#4

You had to post that in scripting request, but anyway.
PS: There's a better way to countdown, check some tutorials tht they don't use 4 timers for just that.
pawn Код:
CMD:count( playerid, params[ ] )
{
    new
        pName[ MAX_PLAYER_NAME ],
        string[ 128 ]
    ;
    if(a == false)
    {
        a = true;
        GetPlayerName(playerid, pName, 30);
        format(string, 280, "[INFO]:%s je pokrenuo odbrojavanje.", pName);
        SendClientMessageToAll(COLOR_LIGHTBLUE, string);
        for(new i; i < MAX_PLAYERS; i++)
        {
            GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,4);
            GetPlayerPos(i,X,Y,Z);
            PlayerPlaySound(i,1056,X,Y,Z);
        }
        SetTimer("count2",1000,0);
        SetTimer("count1",2000,0);
        SetTimer("countgo",3000,0);
        SetTimer("stop",6000,0);
    }
    else SendClientMessage(playerid, 0xFF9900AA, "[INFO]:Vec je pokrenuto.");
    return 1;
}
Reply
#5

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)