Textdraw
#1

PHP код:
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
Reply
#2

Put your
PHP код:
pData[lookupid][Admin] = level
above the
PHP код:
if(pData[lookupid][Admin] >= 3
Reply
#3

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
Put your
PHP код:
pData[lookupid][Admin] = level
above the
PHP код:
if(pData[lookupid][Admin] >= 3
Thanks i have onther problem

PHP код:
        case dREGISTER//register dialog
        
{
            if(!
response) return Kick(playerid); //if they clicked Quit, we will kick them
            
if(strlen(inputtext) < 6) return ShowPlayerDialog(playeriddREGISTERDIALOG_STYLE_INPUT"Register""In order to play, you need to register.\nYour password must be at least 6 characters long!""Register""Quit");
            
//strlen checks a lenght of a string. so if player types their password that is lower than 6, we tell them; Your password must be at least 6 characters long!
                
WP_Hash(pData[playerid][Password], 129inputtext); //hashing inputtext
                
new Msg[130], str[800];
                 
format(strsizeof(str), "INSERT INTO `players`(`Username`, `Password`, `IP`, `Admin`, `VIP`, `Kills`, `Cookies`, `Cakes`, `Icecream`, `Deaths`, `Score`, `Money`, `Hours`, `Minutes`,`RaceWon`) VALUES ('%s','%s','%s',0,0,0,0,0,0,0,0,0,0,0,0)"GetName(playerid), pData[playerid][Password], IP[playerid]);
                
mysql_query(mysqlstr);
                
pData[playerid][ID] = cache_insert_id(); //loads the ID of the player in the variable once they registered.
                
printf("New account registered. ID: %d"pData[playerid][ID]); //just for debugging.
                
pData[playerid][Money] = 50000;
                
GivePlayerMoney(playerid50000);
                
format(joinMsgsizeof(joinMsg), "02[%d] 03*** 11,12* Player %s has registered new at ZoneX (Zx)",playeridGetName(playerid));
                
IRC_GroupSay(groupIDIRC_CHANNELjoinMsg);
             
pData[playerid][Admin] = 1;
             
pData[playerid][RaceWon] = 0;
            
//let's execute the query
        

It doesn't give him level 1 after registration
Reply
#4

Can't see anything.
Did you printed your variable? I'm pretty sure it have to set it.
Reply
#5

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
Can't see anything.
Did you printed your variable? I'm pretty sure it have to set it.
I didn't print it but when the play relog it makes his level 0
Reply
#6

So you need to load and reset the variable for the player.
Reply
#7

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
So you need to load and reset the variable for the player.
What do you mean?
Reply
#8

Quote:
Originally Posted by Loinal
Посмотреть сообщение
What do you mean?
Save the level somewhere. And if the player logs back in set him his level.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)