[Tutorial] ZCMD - Commands collection [PART 1]
#1

ZCMD - COMMAND COLLECTION [PART 1]


Hi all and welcome to my first tutorial! This tutorial is about ZCMD-commands, which are really easy to write and are easy explained! Each Part includes a few commands, step by step explained! Today, I'll show you these commands:
  • The simple "energy/heal"-CMD
  • The "kick"-CMD
  • The "ban"-CMD
  • The "clearchat"-CMD
  • The "freeze/unfreeze"-CMD
Requirements:
- Basic knowledge of "PAWN"
- Saving/Registersystem (including an enum for the player-info)



NOTE: READ the comments given in the commands! Let's roll!

The "/energy"- command:


Description: The famous "energy-command" lets a player, which is at a high enough level, fill his health again up to 100! This is the simplest command, and I'll show it to you, because it's just the start!

First of all, let's write this CMD, while also setting the permissions:
pawn Code:
CMD:energy(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 5) // I don't know what your enum includes and how it looks like, mine is with "pAdmin" defined, which is used to be the "Adminlevel"! So here we check, which level can use this command, you can change it to any level you want/need!
        {
         
        }
           return 1;
    }
Now that we've set the structure, we gotta give the player the health, if he's allowed to perform this command:
pawn Code:
CMD:energy(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 5)
        {
            SetPlayerHealth(playerid, 100); //if he's allowed, restore his health
            SendClientMessage(playerid, COLOR_GREY, "Health has been restored to 100."); // and send him the success-message
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!"); // if not, send him only the following message
        }
        return 1;
    }
Pretty easy, eh? Now we'll get a little deeper:

The "/kick"- command:


Description: What would be a server without a kick-CMD? If someone bothers you or is fuckin' around, you can easily throw him out of your server!

First, we'll set the permissions again:

pawn Code:
CMD:kick(playerid,params[])
{
   if(PlayerInfo[playerid][pAdmin] >= 3)  //Idk again how your enum's defined, however, here we'll set the permissions
  {


  }
   return 1;
}
Now, we wanna define the playerid, which we can kick, the reason and the names we wanna get! First of all, you'll have to create this stock, so that the compiler will know the function we'll use! Create this stock anywhere in your script, but not in any callback!

pawn Code:
stock PlayerName(playerid)
            {
            new pName[25];
            GetPlayerName(playerid, pName, sizeof(pName));
            return pName;
            }
Okay, now we'll be able to define stuff:

pawn Code:
CMD:kick(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 3) {
            new PID; //define the playerid we wanna kick
            new reason[64]; //the reason, put into a string
            new str[128]; //a new message string
            new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
            GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
            GetPlayerName(PID, Playername, sizeof(Playername));
            if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)

            if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
                return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

            format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
        SendClientMessageToAll(COLOR_RED, str); //send that message to all
        Kick(PID); //kick the playerid we've defined

        }
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!"); //return this message
        }
        return 1;
    }
Pretty easy, if you understand, eh? You just have to be sure that you use your defined variables in the right way at the right place!!

The "/ban"- command:


Description: This one is pretty similar to the kick-CMD, just that it won't let the user come back again, while it blocks his IP!

We'll just go on like at the other commands, first the permissions:

pawn Code:
CMD:ban(playerid,params[])
{
   if(PlayerInfo[playerid][pAdmin] >= 3)  //again here you have to set your own enum-infos, however, here we'll set the permissions
  {


  }
   return 1;
}
Then, we'll define everything in the same way again, the ID, the reason, the string for the message and the function for getting player - and adminname!

pawn Code:
CMD:ban(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 3) {
            new PID; //define the playerid we wanna ban
            new reason[64]; //the reason, put into a string
            new str[128]; //a new message string
            new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
            GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
            GetPlayerName(PID, Playername, sizeof(Playername));
            if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)

            if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
                return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

            format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
        SendClientMessageToAll(COLOR_RED, str); //send that message to all
        Ban(PID); //Ban the playerid we've defined

        }
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!"); //return this message
        }
        return 1;
    }
Also easy, not? Nearly the same as the "kick"-CMD! Let's get again a little deeper with the next command!

The "/freeze-unfreeze"- commands:


Description: If you freeze a player, he/she will not be able to move anymore until you'll unfreeze him/her! (Or until she'll disconnect)!

First of all, you gotta have a saving/registersystem, which also includes an enum! I am pretty sure that you have got such a one, right?

pawn Code:
enum pInfo
    {
        pPass,
        pCash,
        pAdmin,
        pKills,
        pDeaths
       

    }
    new PlayerInfo[MAX_PLAYERS][pInfo];
This is only MINE, don't copy-paste wild around now, look if you got one, and then store the "frozen-variable" into it:

pawn Code:
enum pInfo
{
  pPass,
  pCash,
  pAdmin,
  pKills,
  pDeaths,
  Frozen
}
Very good, now we can start again! Setting permissions firstly wouldn't be bad:

pawn Code:
CMD:freeze(playerid,params[])
{
  if(PlayerInfo[playerid][pAdmin] >=4 ) //setting permissions, again your enum-stuff here, don't take mine 1:1
  {

  }

  return 1;
}
Now, we'll not only got to define the stuff from earlier, we'll also check the enum's variables and set them to true, so the compiler knows that the player's frozen in this command!

pawn Code:
COMMAND:freeze(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
            new Target; //defines the playerid we wanna freeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /freeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
            if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
                return SendClientMessage(playerid, COLOR_GREY, "ERROR:Player is not connected!");
            if(!sscanf(params, "u", Target))
            {
               if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
                if(PlayerInfo[Target][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to freeze him
                new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
                GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
                new pname[MAX_PLAYER_NAME]; //define the adminname
                GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
                new tstring[128]; //define the string for the player (victim)
                new pstring[128];// define the string for the admin which is performing
                new astring[128];//define the string for all the players which are online
                format(tstring,sizeof(tstring),"You have been frozen by administrator %s! You cant move!",pname); //this is formatting the player-string, while it's also getting the adminname
                format(pstring,sizeof(pstring),"You have frozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
                format(astring,sizeof(astring),"Administrator %s has frozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
                SendClientMessage(Target,COLOR_GOLD,tstring);//sends the message to the victim
                SendClientMessage(playerid,TEAM_GROVE_COLOR,pstring);//sends the message to the admin
                SendClientMessageToAll(COLOR_LIGHTBLUE,astring);//sends the message to everybody
                TogglePlayerControllable(Target,0); //with that function, the player won't be able to mov, while we're using the variable "Target" as the playerid
                PlayerInfo[Target][Frozen] = 1;//IMPORTANT:we're getting the variable "[frozen]" out of the enum, and set it's value to "1', the compiler knows now that the player is frozen
            }
           
    }
       
// if he doesn't have permissions, return that message!
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 5 to use this command!");
    return 1;
}
The most important thing for you is this line:
pawn Code:
PlayerInfo[Target][Frozen] = 1;
We're telling the compiler, that he should put the variable "frozen" outta the enum into the info of the player! If you set the value to 1, the compiler knows that the player is frozen now!

Also that wasn't that difficult, the "unfreeze-CMD" is the same, we just have to set the enum's variable to "0" that the compiler knows that the player's unfrozen yet:

pawn Code:
COMMAND:unfreeze(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
            new Target; //defines the playerid we wanna unfreeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unfreeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
            if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
                return SendClientMessage(playerid, COLOR_GREY, "ERROR:Player is not connected!");
            if(!sscanf(params, "u", Target))
            {
               if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
                if(PlayerInfo[Target][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to unfreeze him
                new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
                GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
                new pname[MAX_PLAYER_NAME]; //define the adminname
                GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
                new tstring[128]; //define the string for the player (victim)
                new pstring[128];// define the string for the admin which is performing
                new astring[128];//define the string for all the players which are online
                format(tstring,sizeof(tstring),"You have been unfrozen by administrator %s! You cant move!",pname); //this is formatting the player-string, while it's also getting the adminname
                format(pstring,sizeof(pstring),"You have unfrozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
                format(astring,sizeof(astring),"Administrator %s has unfrozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
                SendClientMessage(Target,COLOR_GOLD,tstring);//sends the message to the victim
                SendClientMessage(playerid,TEAM_GROVE_COLOR,pstring);//sends the message to the admin
                SendClientMessageToAll(COLOR_LIGHTBLUE,astring);//sends the message to everybody
                TogglePlayerControllable(Target,1); //with that function, the player will be able to move again, while we're using the variable "Target" as playerid again
                PlayerInfo[Target][Frozen] = 0;//IMPORTANT:we're getting the variable "[frozen]" out of the enum, and set it's value to "0", the compiler knows now that the player is unfrozen
            }
           
    }
       
// if he doesn't have permissions, return that message!
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 5 to use this command!");
    return 1;
}
NOTE: For advanced scripters, we would be able to see after a disconnect whether the player is still frozen or not! We can make that very easy under the callback "OnPlayerSpawn":

pawn Code:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][Frozen] == 1) //Get the info outta the enum and check if the player is still frozen
    {
        TogglePlayerControllable(playerid,0); //Won't let the player move
        SendClientMessage(playerid,red,"WARNING: You are still frozen!"); //Send him a message
    }
     return 1;
}
Not that advanced...^^ Let's get to the last command, which is more than simple but useful to have an little "overview" for your chat:

The "/clearchat"- commands:


Description: This command is pretty easy and also pretty useful if you wanna clear the chat from spam, shit and stuff your players have written! First, we'll set the permissions again:

pawn Code:
CMD:clearchat(playerid,params[])
{
   if(PlayerInfo[playerid][pAdmin] >= 1)
   {

   }
 return 1;
}
Don't worry, we don't need to use 100 functions for clearing the chat, there's a trick:
We'll use a loop which will send 100 "SendClientMessageToAll"'s, and while the color is set to white, it looks like the chat got cleared, because the string is empty!

pawn Code:
COMMAND:clearchat(playerid,params[])
{
   if( PlayerInfo[ playerid ][ pAdmin ] < 1 ) return SendClientMessage( playerid, COLOR_RED, "ERROR: You must be level 1 to use this command!" );
{
     for( new i = 0; i <= 100; i ++ ) SendClientMessageToAll( COLOR_WHITE, "" );
}   return 1;
}
Soooo, that was my simple and little tutorial about a few ZCMD-commands, which could be useful more in DM servers, but also some of them in RP-servers! I hope I did my job well and any criticism is welcome!


Creditzz:
ZCMD - by Zeekx
sscanf2 - by Y_Less
Commands, tutorial and explanations - by Twisted_Insane
Reply
#2

The are parts that you don't explain much, only the defines and if player is connected/Invalid Player ID.
Also, I notice something that you never use.
What's the point of the PlayerName( playerid ), if you never use it and define new variables for the names then GetPlayerName etc..
pawn Code:
stock PlayerName(playerid)
{
    new pName[25];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}
You could save lines by doing
pawn Code:
PlayerName( playerid );
// OR
PlayerName( PID );
Last, at the /clearchat command, it's hilarious! Better with loop
pawn Code:
COMMAND:clearchat( playerid, params[ ] )
{
    if( PlayerInfo[ playerid ][ pAdmin ] < 1 ) return SendClientMessage( playerid, COLOR_RED, "ERROR: You must be level 1 to use this command!" );
    {
        for( new i = 0; i <= 100; i ++ ) SendClientMessageToAll( COLOR_WHITE, "" );
    }
    return 1;
}
Reply
#3

I was just looking for this thanks good tutorial
Reply
#4

@Dwane

This stock could, even if not neccessary here, be used for other things at all! At the thing with the loops I have to give you right, I'll just fix it right now!

@Mr.Fames

Thank you, the next part will be comin' soon!
Reply
#5

Quote:
Originally Posted by Twisted_Insane
View Post
pawn Code:
CMD:freeze(playerid,params[])
{
  if(PlayerInfo[playerid][pAdmin] >=4 ) //setting permissions, again your enum-stuff here, don't take mine 1:1
  {

  }

  return 1;
}
Now, we'll not only got to define the stuff from earlier, we'll also check the enum's variables and set them to true, so the compiler knows that the player's frozen in this command!

pawn Code:
COMMAND:freeze(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
            new Target; //defines the playerid we wanna freeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /freeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
            if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
                return SendClientMessage(playerid, COLOR_GREY, "ERROR:Player is not connected!");
            if(!sscanf(params, "u", Target))
            {
               if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
                if(PlayerInfo[Target][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to freeze him
                new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
                GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
                new pname[MAX_PLAYER_NAME]; //define the adminname
                GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
                new tstring[128]; //define the string for the player (victim)
                new pstring[128];// define the string for the admin which is performing
                new astring[128];//define the string for all the players which are online
                format(tstring,sizeof(tstring),"You have been frozen by administrator %s! You cant move!",pname); //this is formatting the player-string, while it's also getting the adminname
                format(pstring,sizeof(pstring),"You have frozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
                format(astring,sizeof(astring),"Administrator %s has frozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
                SendClientMessage(Target,COLOR_GOLD,tstring);//sends the message to the victim
                SendClientMessage(playerid,TEAM_GROVE_COLOR,pstring);//sends the message to the admin
                SendClientMessageToAll(COLOR_LIGHTBLUE,astring);//sends the message to everybody
                TogglePlayerControllable(Target,0); //with that function, the player won't be able to mov, while we're using the variable "Target" as the playerid
                PlayerInfo[Target][Frozen] = 1;//IMPORTANT:we're getting the variable "[frozen]" out of the enum, and set it's value to "1', the compiler knows now that the player is frozen
            }
           
    }
       
// if he doesn't have permissions, return that message!
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 5 to use this command!");
    return 1;
}
The most important thing for you is this line:
pawn Code:
PlayerInfo[Target][Frozen] = 1;
We're telling the compiler, that he should put the variable "frozen" outta the enum into the info of the player! If you set the value to 1, the compiler knows that the player is frozen now!

Also that wasn't that difficult, the "unfreeze-CMD" is the same, we just have to set the enum's variable to "0" that the compiler knows that the player's unfrozen yet:

pawn Code:
COMMAND:unfreeze(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
            new Target; //defines the playerid we wanna unfreeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /unfreeze [playerid]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
            if(!IsPlayerConnected(Target)) //if the ID doesn't exist, return an error-message
                return SendClientMessage(playerid, COLOR_GREY, "ERROR:Player is not connected!");
            if(!sscanf(params, "u", Target))
            {
               if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: Cant perform this command on yourself!" ); //I wouldn't add this line, because it won't let you perform this CMD on yourself
                if(PlayerInfo[Target][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are higher than your level!"); // if the player you're performing this command on has a higher level as you, return a message, you ain't able to unfreeze him
                new tname[MAX_PLAYER_NAME]; //define the new target-name of the playerid
                GetPlayerName(Target,tname,sizeof(tname)); //get the playername with this function
                new pname[MAX_PLAYER_NAME]; //define the adminname
                GetPlayerName(playerid,pname,sizeof(pname)); //get the adminname with this function
                new tstring[128]; //define the string for the player (victim)
                new pstring[128];// define the string for the admin which is performing
                new astring[128];//define the string for all the players which are online
                format(tstring,sizeof(tstring),"You have been unfrozen by administrator %s! You cant move!",pname); //this is formatting the player-string, while it's also getting the adminname
                format(pstring,sizeof(pstring),"You have unfrozen player %s(%d)!",tname,Target); //this is formatting the adminname-string, while it's also getting the playername and his ID(target)
                format(astring,sizeof(astring),"Administrator %s has unfrozen %s!",pname,tname); //this is formatting the all-string, while it's sending this message to everybody and is getting admin- and playername
                SendClientMessage(Target,COLOR_GOLD,tstring);//sends the message to the victim
                SendClientMessage(playerid,TEAM_GROVE_COLOR,pstring);//sends the message to the admin
                SendClientMessageToAll(COLOR_LIGHTBLUE,astring);//sends the message to everybody
                TogglePlayerControllable(Target,1; //with that function, the player will be able to move again, while we're using the variable "Target" as playerid again
                PlayerInfo[Target][Frozen] = 0;//IMPORTANT:we're getting the variable "[frozen]" out of the enum, and set it's value to "0", the compiler knows now that the player is unfrozen
            }
           
    }
       
// if he doesn't have permissions, return that message!
    else return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be level 5 to use this command!");
    return 1;
}
[/I]
I believe I told you already...You don't need three strings for messages, also you missed a closing parenthesis in the unfreeze command.
Reply
#6

@Antonio

Yes, you're probably right, it would be a waste "of strings" if you'd send it 3 times, should be okay if only the performer and the victim get the message, right?

For the freeze-cmd:

You mean that line?

TogglePlayerControllable(Target,1;

^If yes, fixed...
Reply
#7

1) also check if player is actually frozen, before the "unfreeze" command is done.
2) instead of using PlayerName stock, you can create 2D array
pawn Code:
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME]
and then GetPlayerName when player connects
pawn Code:
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, PlayerName[playerid], MAX_PLAYER_NAME);
    return 1;
}
and you can use it like
pawn Code:
new
     string[128];
format(string, sizeof(string), "Administrator %s has frozen %s", PlayerName[playerid], PlayerName[targetid]);
SendClientMessageToAll(SOMECOLOR, string);
Reply
#8

I used that, but in another way, as you can see! I've formatted too many strings, but the way like they work is the same! It sends the message to all!
Reply
#9

Little note for my next part:

Already got a few commands in point, any suggestions from your side? A few commands which are really popular and useful would be appreciated!
Reply
#10

I followed everything but when i do the command on my self i get the message USAGE: Type /kick id reason
On every commands.
Reply
#11

Show me your kick-command, you probably got some mistakes!
Reply
#12

I got same Errors
pawn Code:
(210) : error 010: invalid function or declaration
(214) : error 010: invalid function or declaration
(235) : error 010: invalid function or declaration
(239) : error 010: invalid function or declaration
(403) : warning 203: symbol is never used: "ban"
(403) : warning 203: symbol is never used: "kick"
and code
pawn Code:
format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
    SendClientMessageToAll(COLOUR_RED, str);
    Kick(PID);
    }
    else //rove 209
    {
        SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!");
    }
    return 1;//rove 213
}
////////////////////////////////////////////////////////////////////////////////////
        Ban(PID);

        }
        else //rove 233
        {
            SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!");
        }
        return 1;//rove 237
    }
Hope someone can help me with this error ^^
Reply
#13

You sure you have the newest sscanf2 include / plugin? Also, try it like this:

pawn Code:
else return SendClientMessage(playerid, COLOR_RED, "You need to be level 2 to use that command!");
Delete the "else-statement" you have right now and replace it with the new one! If it didn't work, show me your whole command!
Reply
#14

Quote:
Originally Posted by Twisted_Insane
View Post
We're telling the compiler, that he should put the variable "frozen" outta the enum into the info of the player! If you set the value to 1, the compiler knows that the player is frozen now!

Also that wasn't that difficult, the "unfreeze-CMD" is the same, we just have to set the enum's variable to "0" that the compiler knows that the player's unfrozen yet:
You're not telling the compiler anything. The compiler has no idea what this code does, it just knows that it's valid and it will compile it into a valid .amx file that the SA-MP server can run. When doing (var = something) you're merely changing pieces of memory. You're accessing a specific memory address, and changing that data in it. The compiler knows nothing of this.

A #define is used to communicate with the (pre-)compiler. A variable, cannot interact with the (pre-)compiler.

Apart from the small mis-understanding issues on your part, this is good for beginners. I would take a look at a few of your commands though, you have unused variables and needless variables hanging around. You could save a lot of memory in places!
Reply
#15

Hey!

Yeah, it was my first tutorial, though. Compared to my current knowledge, at this time I could've been described as 'idiot'!

To the compiler:

You're absolutely right, and actually, I knew this even, since I've learned this 'lesson' while reading about Java programming a time ago! Thanks for the feedback! :P
Reply
#16

How to unban?
Reply
#17

Hey, nice tutorial. You seem like a guy that likes to help people. can you tell me the CMD to make a player a a team, just like [frozen] but SS ( for Secret Society) in the /makessleader, but i need it to save when the player exit and login again, please help me with that.
Reply
#18

Never mind i got it working.
Reply
#19

ZCMD - Command Collection [PART 2] - jail, pm, report, acar, fakechat

not taking this link ... I'm doing a system adm so I need a base remade the topic?
Reply
#20

i need cmd /use briefcase , backpack
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)