Scripting Admin Commands.
#7

Quote:
Originally Posted by MacT
Посмотреть сообщение
pawn Код:
enum pInfo
{
    pAdmin,
        bool:pBan
}
new PlayerInfo[MAX_PLAYERS][pInfo];

examle:
CMD:giveweapon(playerid,params[])
{
        if( PlayerInfo[playerid][pAdmin] < 3 ) return 1;
        if(sscanf(params,"udd",params[0],params[1],params[2])) return SendClientMessage(playerid,-1,"Usage:{ff0000} /GiveWeapon [playerid] [WeaponID] [Amount]");
        GivePlayerWeapon(params[0],params[1],params[2]);
        SendFormatMessage(playerid,-1,"{FF00FF}You gaved to %s weapon",GetName[ params[0] ]);
        SendFormatMessage(params[0],-1,"{FF00FF}The admin %s gaved you weapon",GetName[playerid]);
        return 1;
}
Why are you using params ?

pawn Код:
enum pInfo
{
    pAdmin,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

CMD:setscore(playerid,params[])
{
new score;
new id;
new pName;
new aName;
new string[128];
GetPlayerName(playerid,pName,sizeof(pName));
GetPlayerName(id,aName,sizeof(aName));
if(sscanf(params, "ui", id, score)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/setscore [id] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Invalid playerid");
if(PlayerInfo[playerid][pAdmin] <4) return SendClientMessage(playerid,COLOR_RED,"You are not authorized to use this command");
format(string,sizeof(string),"Administrator %s has set your score to %d",pName,score);
SendClientMessage(id,COLOR_RED,string);
format(string,sizeof(string),"You have set %s's score to %d",aName,score);
SendClientMessage(playerid,COLOR_RED,string);
SetPlayerScore(id,score);
return 1;
}
Reply


Messages In This Thread
Scripting Admin Commands. - by CesarLT - 04.06.2014, 19:01
Re: Scripting Admin Commands. - by MacT - 04.06.2014, 19:19
Re: Scripting Admin Commands. - by CesarLT - 04.06.2014, 19:20
Re: Scripting Admin Commands. - by MacT - 04.06.2014, 19:43
Re: Scripting Admin Commands. - by ReD_HunTeR - 04.06.2014, 19:48
Re: Scripting Admin Commands. - by CesarLT - 04.06.2014, 19:50
Re: Scripting Admin Commands. - by Johnson_Brooks - 04.06.2014, 19:54
Re: Scripting Admin Commands. - by CesarLT - 04.06.2014, 22:22
Re: Scripting Admin Commands. - by CesarLT - 05.06.2014, 12:46
Re: Scripting Admin Commands. - by MacT - 05.06.2014, 12:57

Forum Jump:


Users browsing this thread: 1 Guest(s)