Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Textdraw

$
0
0
PHP Code:

CMD:setlevel(playeridparams[])
{
    new 
lookupidstr[128], level;
    if(
pData[playerid][Admin] >= || IsPlayerAdmin(playerid))
    {
        if(
sscanf(params,"ud",lookupid,level)) return SendClientMessage(playeridCOLOR_YELLOW"Usage: /setlevel (UserID | UserName) (level)");
        if(
pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1"Sorry you cant setlevel becoz his level is higher then you");
        if(
level == || level 10 || level || level == 0) return SendClientMessage(playeridred"ERROR: Invalid Level [Levels 3 to 10 or 1]"); // you can change this to any level you want
        
if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid,0xFF0000FF"Sorry this player isnt connected ");
        if(
level pData[lookupid][Admin])
        {
            new 
irc[130];
            
format(irc,sizeof(str),"8,3* Admin %s (ID: %d) Demoted %s (ID: %d) to level %d",GetName(playerid), playerid,GetName(lookupid),lookupid,level);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has demoted you to level %d",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupid0xFF0000FFstr);
            
format(strsizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playerid, -1str);
            if(
pData[lookupid][Admin] == 1)
            {
            
onlineadmins--;
            new 
strings[100+1000];
            
format(stringssizeof(strings), "Online Admins: %d",onlineadmins);
            
TextDrawSetString(oastrings);
            
TextDrawShowForPlayer(playeridoa);
            }
        }
        if(
level pData[lookupid][Admin])
        {
            new 
irc[130];
            
format(irc,sizeof(str),"8,3* Admin %s (ID: %d) granted level %d to %s (ID: %d)",GetName(playerid), playeridlevel,GetName(lookupid),lookupid);
            
IRC_GroupSay(groupIDIRC_CHANNELirc);
            
format(strsizeof(str), "Admin %s (ID:%d) has granted level %d to you",GetName(playerid), playeridlevel);
            
SendClientMessage(lookupidCOLOR_YELLOWstr);
            
format(strsizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
            
SendClientMessage(playeridCOLOR_YELLOWstr);
            if(
pData[lookupid][Admin] >= 3)
            {
            
onlineadmins++;
            new 
strings[100+1000];
            
format(stringssizeof(strings), "Online Admins: %d",onlineadmins);
            
TextDrawSetString(oastrings);
            
TextDrawShowForPlayer(playeridoa);
            }
        }
        
pData[lookupid][Admin] = level;
        
printf("Setted level %d",level);
        
SavePlayerData(playerid);
    }
    else return 
SendClientMessage(playeridCOLOR_YELLOW"Only +level 9 can use this command");
    return 
1;


The Online admins textdraw is not changing after setting level why? example if i have 1 admin it show 1 admins when i set someone and level the textdraw still showing Online Admins: 1

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>