well, i made so admin cmds
#1

an now when i tied them, idk where the error are or anything, but look:

Код:
CMD:setmod(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setmod [playerid]");
   if(PlayerInfo[PID][pAdmin] == 1) return SendClientMessage(playerid,0xFF0000FF, "That person is already moderator!");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"Owner %s made %s moderator. (Level: 1)", Adminname, Playername);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pAdmin] = 1;
   SendClientMessage(PID, 0xFF000000,"You have been made an moderator!");
   return 1;
}
CMD:setgmod(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setgmod [playerid]");
   if(PlayerInfo[PID][pAdmin] == 1) return SendClientMessage(playerid,0xFF0000FF, "That person is already global moderator!");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"Owner %s made %s Global Moderator. (Level: 2)", Adminname, Playername);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pAdmin] = 2;
   SendClientMessage(PID, 0xFF000000,"You have been made an Global Moderator!");
   return 1;
}
CMD:setadmin(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setadmin [playerid]");
   if(PlayerInfo[PID][pAdmin] == 1) return SendClientMessage(playerid,0xFF0000FF, "That person is already admin!");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"Owner %s made %s admin. (Level: 3)", Adminname, Playername);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pAdmin] = 3;
   SendClientMessage(PID, 0xFF000000,"You have been made an admin!");
   return 1;
}
CMD:sethealth(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /sethealth [playerid] [amount] [reason]");

   if(amount > 100) return SendClientMessage(playerid,0xFF0000FF,"Max 100!");//Available levels
   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s health have been sat to %s by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerHealth(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed you health!");
   return 1;
}
CMD:setarmour(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setarmour [playerid] [amount] [reason]");
   if(amount > 100) return SendClientMessage(playerid,0xFF0000FF,"Max 100!");//Available levels

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s armour have been sat to %s by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerArmour(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed you armour!");
   return 1;
}
CMD:setmoney(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setmoney [playerid] [amount] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s moneys have been sat to %s by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   GivePlayerMoney(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed you money!");
   return 1;
}
CMD:setskin(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setskin [playerid] [amount] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s skin have been sat to %s by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerSkin(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed you skin!");
   return 1;
}
CMD:setkills(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, amount, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setkills [playerid] [amount] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s kills have been sat to %s by Admin %s. Reason: %s", Playername, amount, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerScore(PID, amount);
   SendClientMessage(PID, 0xFF000000,"An admin changed your kills!");
   return 1;
}
CMD:resetkills(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /resetkills [playerid] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s kills have been reseted by Admin %s. Reason: %s", Playername, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerScore(PID, 0);
   PlayerInfo[PID][pKills] = 0;
   SendClientMessage(PID, 0xFF000000,"An admin reseted your kills!");
   return 1;
}
CMD:resetdeaths(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /resetdeaths [playerid] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s deaths have been reseted by Admin %s. Reason: %s", Playername, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pDeaths] = 0;
   SendClientMessage(PID, 0xFF000000,"An admin reseted your deaths!");
   return 1;
}
CMD:resetstats(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 4 ) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /resetdeaths [playerid] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s account have been reseted by Admin %s. Reason: %s", Playername, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pDeaths] = 0;
   PlayerInfo[PID][pKills] = 0;
   PlayerInfo[PID][pCash] = 0;
   PlayerInfo[PID][pMuted] = 0;
   PlayerInfo[PID][pAdmin] = 0;
   SetPlayerArmour(PID, 0);
   SetPlayerHealth(PID, 100);
   SendClientMessage(PID, 0xFF000000,"An admin reseted your account!");
   return 1;
}
CMD:setcolor(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new color;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, color, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setcolor [playerid] [color] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s color have been changed (hex: %s) by Admin %s. Reason: %s", Playername, color, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerColor(PID, color);
   SendClientMessage(PID, 0xFF000000,"An admin changed your color!");
   return 1;
}
CMD:givejet(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /givejet [playerid] [reason]");

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"%s got a jetpack spawned by Admin %s. Reason: %s", Playername, Adminname, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   SetPlayerSpecialAction(PID,SPECIAL_ACTION_USEJETPACK);
   SendClientMessage(PID, 0xFF000000,"An admin gave you a jetpack!");
   return 1;
}
CMD:jetpack(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
   SendClientMessage(playerid, 0xFF000000,"Spawned an jetack!");
   return 1;
}
CMD:givewep(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new reason[64];
   new str[128];
   new amount;
   new ammo;
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(sscanf(params, "s[64]", PID, amount, ammo, reason)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /givewep [playerid] [weaponid] [ammo] [reason]");
   if(amount < 1 || amount >46) return SendClientMessage(playerid,0xFF0000FF,"Wrong ID!");//Available levels
   if(ammo > 350) return SendClientMessage(playerid,0xFF0000FF,"Max 350 ammo!");//Available levels

   if(!IsPlayerConnected(PID))
       return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"Admin %s gave %s a weapon (ID: %s with ammo %s). Reason: %s", Adminname, Playername, amount, ammo, reason);
   SendClientMessageToAll(0xFF0000C8, str);
   GivePlayerWeapon(PID, amount, ammo);
   SendClientMessage(PID, 0xFF000000,"An admin gave you a weapon!");
   return 1;
}
and i got this:



help? :X
Reply
#2

pawn Код:
if(sscanf(params, "u", PID)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setgmod [playerid]");
and should be before getting a players name... if not it will cause bugs
Reply
#3

what you mean?
Reply
#4

You should first get the sscanf params and then get the players name, and it should be 'u' (PlayerName/ID), so it should be like :
pawn Код:
CMD:setgmod(playerid, params[])
{
   if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, 0x99333300, "You can't make your own commands smartass!");
   new PID;
   new str[128];
   new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
   
   if(sscanf(params, "u", PID)) return SendClientMessage(playerid, 0xFF0000C8, "USAGE: /setgmod [playerid]");

   GetPlayerName(playerid, Adminname, sizeof(Adminname));
   GetPlayerName(PID, Playername, sizeof(Playername));

   if(PlayerInfo[PID][pAdmin] == 1) return SendClientMessage(playerid,0xFF0000FF, "That person is already global moderator!");

   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000C8, "Player is not Connected!");

   format(str,sizeof(str),"Owner %s made %s Global Moderator. (Level: 2)", Adminname, Playername);
   SendClientMessageToAll(0xFF0000C8, str);
   PlayerInfo[PID][pAdmin] = 2;
   SendClientMessage(PID, 0xFF000000,"You have been made an Global Moderator!");
   return 1;
}
Reply
#5

That will remove the sscanf warning too or?
Reply
#6

it should
Reply
#7

NOw i got this :

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)