Administration Labels [Up to head]
#2

Dont re-create same 3d text over and over again, just update it...
PHP код:
new
    
Text3D:AdminLabel[MAX_PLAYERS];
CMD:makeadmin(playerid,params[])
{
    new 
poruka[256],poruka2[650],poruka3[650],ID,level,randomiziraj random(99999);
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid,-1,"{FF0000}Greska:{FFFFFF} Niste se spojili na server");
    if(
pUlogiran[playerid] != 1) return SendClientMessage(playerid,-1,"{FF0000}Greska:{FFFFFF} Niste ulogirani na server.");
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"{FF0000}Greska:{FFFFFF} Nemate dozvolu za tu komandu");
    if(
sscanf(params,"ud",ID,level)) return SendClientMessage(playerid,-1,"{FF0000}Koristenje:{FFFFFF} /makeadmin [ID/ime] [level]");
    {
        if(
level || level 5) return SendClientMessage(playerid,-1,"{FF0000}Greska:{FFFFFF} Dozvoljeni admin leveli za dodijelu: 0-5");
        if(
ID == playerid)
        {
            
PlayerInfo[playerid][pAdminKod] = randomiziraj;
            
PlayerInfo[playerid][pAdministrator] = level;
            
SetPlayerSkin(playerid,294);
            
format(poruka,256,"{FF0000}[A-INFO]: %s {FFFFFF}%s je postavio sebe za administratora na levelu %d",GetPlayerAdminRank(playerid),GetName(playerid),level);
            
SendAdminMessage(-1,poruka);
            
format(poruka2,650,"{FFFFFF}Postavili ste se na administracijsku poziciju. Pozicija: %s.\nKao clan administracije prihvacate pravila napisana na nasoj forum stranici.\nCestitke na tituli od citave WG Administracije.Nadamo se da cete uspjesno ispunjvati svoju duznost.\n\n{FF0000}*{FFFFFF} Dolje navedeni kod zapisite negdje na papir ili u text dokument jer ce vam\npri svakom logiranju na server on biti potreban za ulazenje na racun:\n%d",GetPlayerAdminRank(playerid),randomiziraj);
            
ShowPlayerDialog(playerid,DIALOG_DEFAULT,DIALOG_STYLE_MSGBOX,"WG Administration",poruka2,"Uredu","");
            
printf("ADMIN: %s je postavio vlastiti admin level na %d",GetName(playerid),level);
            new 
Float:x,Float:y,Float:z;
            
GetPlayerPos(playerid,x,y,z);
            
format(poruka,128,"{FF0000}[%s{FF0000}]",GetPlayerAdminRank(playerid));
            
Update3DTextLabelText(AdminLabel[playerid],0xEEEE88FF,poruka);
            
            
            
TogglePlayerControllable(playerid,1);
            new 
INI:UFile INI_Open(UserPath(ID));
            
INI_SetTag(UFile,"Podatci");
            
INI_WriteInt(UFile,"pAdminKod",PlayerInfo[ID][pAdminKod]);
            
INI_Close(UFile);
        }
        else
        {
            
PlayerInfo[ID][pAdminKod] = randomiziraj;
            
PlayerInfo[ID][pAdministrator] = level;
            
SetPlayerSkin(ID,294);
            
format(poruka,256,"{0080FF}WG{FFFFFF}: %s {FFFFFF}%s vas je postavio za administratora na levelu %d. Cestitamo!",GetPlayerAdminRank(playerid),GetName(playerid),level);
            
SendClientMessage(ID,-1,poruka);
            
format(poruka3,650,"{FFFFFF}Postavljeni ste na administraciju poziciju od strane vlasnika. Pozicija: %s.\nKao clan administracije prihvacate pravila napisana na nasoj forum stranici.\nCestitke na tituli od citave WG Administracije.Nadamo se da cete uspjesno ispunjvati svoju duznost.\n\n{FF0000}*{FFFFFF} Dolje navedeni kod zapisite negdje na papir ili u text dokument jer ce vam\npri svakom logiranju na server on biti potreban za ulazenje na racun:\n%d",GetPlayerAdminRank(level),randomiziraj);
            
ShowPlayerDialog(ID,DIALOG_DEFAULT2,DIALOG_STYLE_MSGBOX,"WG Administration",poruka3,"Uredu","");
            
format(poruka,256,"{0080FF}WG{FFFFFF}: Postavili ste %sa za administratora na levelu %d",GetName(ID),level);
            
SendClientMessage(playerid,-1,poruka);
            
format(poruka,256,"{FF0000}[A-INFO]: %s {FFFFFF}%s je postavio %su administratora na levelu %d",GetPlayerAdminRank(playerid),GetName(playerid),GetName(ID),level);
            
SendAdminMessage(-1,poruka);
            
printf("ADMIN: %s je postavio %s za administratora na levelu %d",GetName(playerid),GetName(ID),level);
            new 
Float:x,Float:y,Float:z;
            
GetPlayerPos(ID,x,y,z);
            
            
format(poruka,128,"{FF0000}[%s{FF0000}]",GetPlayerAdminRank(playerid));
            
Update3DTextLabelText(AdminLabel[playerid],0xEEEE88FF,poruka);
            
            
            
TogglePlayerControllable(ID,1);
            new 
INI:UFile INI_Open(UserPath(ID));
            
INI_SetTag(UFile,"Podatci");
            
INI_WriteInt(UFile,"pAdminKod",PlayerInfo[ID][pAdminKod]);
            
INI_Close(UFile);
        }
     }
    return 
1;
}
OnPlayerLogin(playerid) { //or whatever you use when they spawn for the first time
    
format(poruka,128,"{FF0000}[%s{FF0000}]",GetPlayerAdminRank(ID));
       
AdminLabel[playerid] = Create3DTextLabel(poruka,-1,x,y,z,30.0,0,0); // <---
       
Attach3DTextLabelToPlayer(AdminLabel[playerid],playerid,0.0,0.0,0.3);
    return 
true;

Reply


Messages In This Thread
Administration Labels [Up to head] - by NoDi522 - 18.12.2015, 10:07
Re: Administration Labels [Up to head] - by TwinkiDaBoss - 18.12.2015, 10:16
Re: Administration Labels [Up to head] - by NoDi522 - 18.12.2015, 10:21

Forum Jump:


Users browsing this thread: 1 Guest(s)