Originally Posted by Abernethy
Quote:
Originally Posted by Headucation
Abernethy:
pawn Код:
dcmd_setlevel(playerid,params[]) { if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pLevel] >= 5) { new tmp[256],idx; tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GREY,"Syntax: /setlevel [playerid] [level]"); return true; } new otherid = strval(tmp); if(!IsPlayerConnected(otherid)) { SendClientMessage(playerid,COLOR_GREY,"Incorrect playerid."); return true; } tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GREY,"Syntax: /setlevel [playerid] [level]"); return true; } new level = strval(tmp); if(level > 5) { SendClientMessage(playerid,COLOR_GREY,"The Maximum level is 5"); return true; } new string[256], pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME]; GetPlayerName(otherid,pName,sizeof(pname)); GetPlayerName(playerid,pName2,sizeof(pname2)); format(string,sizeof(string),"%s has made you an administrator (Level: %d)",pName2,level); SendClientMessage(otherid,COLOR_YELLOW,string); format(string,sizeof(string),"You have made %s an Admin (Level: %d)",pName,level); SendClientMessage(playerid,COLOR_YELLOW,string); PlayerInfo[otherid][pLevel] = level; dUserSetINT(PlayerName(otherid)).("AdminLevel", PlayerInfo[otherid][pLevel]); return true; } else return SendClientMessage(playerid,COLOR_RED,"This is an Admin command only."); }
You have to define DCMD and have Latest Version of Dini.inc, Also you have to get a Registration system that was made in Dini, so That the people you add as Admin will get their Level saved,
Hope this helps
|
I just changed the code, to this.
pawn Код:
if (strcmp("/setlevel", cmdtext, true) == 0) { if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pLevel] >= 5) { new tmp[256],idx; tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GREY,"Syntax: /setlevel [playerid] [level]"); return true; } new otherid = strval(tmp); if(!IsPlayerConnected(otherid)) { SendClientMessage(playerid,COLOR_GREY,"Incorrect playerid."); return true; } tmp = strtok(params,idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GREY,"Syntax: /setlevel [playerid] [level]"); return true; } new level = strval(tmp); if(level > 5) { SendClientMessage(playerid,COLOR_GREY,"The Maximum level is 5"); return true; } new string[256], pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME]; GetPlayerName(otherid,pName,sizeof(pname)); GetPlayerName(playerid,pName2,sizeof(pname2)); format(string,sizeof(string),"%s has made you an administrator (Level: %d)",pName2,level); SendClientMessage(otherid,COLOR_RED,string); format(string,sizeof(string),"You have made %s an Admin (Level: %d)",pName,level); SendClientMessage(playerid,COLOR_RED,string); PlayerInfo[otherid][pLevel] = level; //dUserSetINT(PlayerName(otherid)).("AdminLevel", PlayerInfo[otherid][pLevel]); return true; } else return SendClientMessage(playerid,COLOR_RED,"This is an Admin command only."); }
I'm receiving these errors; (I have to go right now, I don't have time to stuff around looking for solutions )
Код:
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(173) : error 017: undefined symbol "params"
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(185) : error 017: undefined symbol "params"
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(198) : error 017: undefined symbol "pname"
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(198) : error 029: invalid expression, assumed zero
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(198) : warning 215: expression has no effect
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(199) : error 017: undefined symbol "pname2"
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(199) : error 029: invalid expression, assumed zero
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(199) : warning 215: expression has no effect
C:\Users\Madhouse\Desktop\Server\filterscripts\pDonation.pwn(172) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
|