/setadminname SS
#1

when i type /setadminname 0 Pince
SS HERE

http://imgur.com/7Grdleu

ITS AGAIN SAID

http://imgur.com/BHX0Xa5

ALSo this bug with /prison or /oprios idk how manyy cmd's also have this bug..

Script is HZRP
Reply
#2

Can you show the code?No one, and I mean no one, can guess what the problem is threw a screen-shot.
Reply
#3

here is

PHP код:
 CMD:setadminname(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        
/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
        {
            SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 1;
        }*/
        
new giveplayeridname[32];
        if(
sscanf(params"us[32]"giveplayeridname))
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: /setadminname [playerid/partofname] [name]");
            return 
1;
        }
        if(
PlayerInfo[giveplayerid][pAdmin] < 1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"The player is not an admin.");
            return 
1;
        }
        if(
AdminDuty[giveplayerid] != 0)
        {
            
SendClientMessage(playeridCOLOR_WHITE"That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
            return 
1;
        }
        new 
length strlen(name);
        if(
length || length 20)
        {
            
SendClientMessage(playeridCOLOR_WHITE"The name can't less than 3 characters or more than 20 characters.");
            return 
1;
        }
        if(
strfind(name"_"true) != -1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"The admin name must be one name. There can't be an underscore in the name.");
            return 
1;
        }
        if(
strcmp(name"Usama"true) == && PlayerInfo[playerid][pAdmin] < 6) {
            
SendClientMessage(playeridCOLOR_WHITE"stop ! im Usama ! you're not Usama !");
            return 
1;
        }
        new 
string[128];
        
format(stringsizeof(string), "AdmCmd: %s has set %s's admin name to '%s'."GetPlayerNameEx(playerid),  GetPlayerNameEx(giveplayerid), name);
        
ABroadCast(COLOR_LIGHTREDstring1);
        
format(PlayerInfo[giveplayerid][pAdminName], 32name);
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

Reply
#4

My eyes hurt when i saw ur code....
PHP код:
CMD:setadminname(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        
/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
        {
            SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 1;
        }*/
        
new giveplayeridname[32];
        if(
sscanf(params"us[32]"giveplayeridname))return SendClientMessage(playeridCOLOR_WHITE"USAGE: /setadminname [playerid/partofname] [name]");
        if(
PlayerInfo[giveplayerid][pAdmin] < 1)return SendClientMessage(playeridCOLOR_WHITE"The player is not an admin.");
        if(
AdminDuty[giveplayerid] != 0)return SendClientMessage(playeridCOLOR_WHITE"That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");

        new 
length strlen(name);
        if(
length || length 20)return SendClientMessage(playeridCOLOR_WHITE"The name can't less than 3 characters or more than 20 characters.");
        if(
strfind(name"_"true) != -1)return SendClientMessage(playeridCOLOR_WHITE"The admin name must be one name. There can't be an underscore in the name.");
        if(
strcmp(name"Usama"true) == && PlayerInfo[playerid][pAdmin] < 6)return SendClientMessage(playeridCOLOR_WHITE"stop ! im Usama ! you're not Usama !");
        
SetPlayerName(giveplayeridname);
        new 
string[128];
        
format(stringsizeof(string), "AdmCmd: %s has set %s's admin name to '%s'."GetPlayerNameEx(playerid),  GetPlayerNameEx(giveplayerid), name);
        
ABroadCast(COLOR_LIGHTREDstring1);
        
format(PlayerInfo[giveplayerid][pAdminName], sizeof(name), name);
    }else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

Reply
#5

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
My eyes hurt when i saw ur code....
His code looks better than yours, tbh. It's easier to read through.

O.T.: a player's name can have a maximum length of 24. Giving the variable a size of 25 and higher is unnecessary. Have you tested the code with a second player instead of on yourself?

EDIT: if it works on someone else, then you should update your sscanf include (to sscanf2 or a newer version of sscanf2). You could also use the 'r' specifier instead of 'u', if you're not planning on using the command on NPCs.
Reply
#6

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
My eyes hurt when i saw ur code....
PHP код:
CMD:setadminname(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 5)
    {
        
/*if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
        {
            SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 1;
        }*/
        
new giveplayeridname[32];
        if(
sscanf(params"us[32]"giveplayeridname))return SendClientMessage(playeridCOLOR_WHITE"USAGE: /setadminname [playerid/partofname] [name]");
        if(
PlayerInfo[giveplayerid][pAdmin] < 1)return SendClientMessage(playeridCOLOR_WHITE"The player is not an admin.");
        if(
AdminDuty[giveplayerid] != 0)return SendClientMessage(playeridCOLOR_WHITE"That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
        new 
length strlen(name);
        if(
length || length 20)return SendClientMessage(playeridCOLOR_WHITE"The name can't less than 3 characters or more than 20 characters.");
        if(
strfind(name"_"true) != -1)return SendClientMessage(playeridCOLOR_WHITE"The admin name must be one name. There can't be an underscore in the name.");
        if(
strcmp(name"Usama"true) == && PlayerInfo[playerid][pAdmin] < 6)return SendClientMessage(playeridCOLOR_WHITE"stop ! im Usama ! you're not Usama !");
        
SetPlayerName(giveplayeridname);
        new 
string[128];
        
format(stringsizeof(string), "AdmCmd: %s has set %s's admin name to '%s'."GetPlayerNameEx(playerid),  GetPlayerNameEx(giveplayerid), name);
        
ABroadCast(COLOR_LIGHTREDstring1);
        
format(PlayerInfo[giveplayerid][pAdminName], sizeof(name), name);
    }else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

That looks like if it was in a car crash.

Quote:

O.T.: a player's name can have a maximum length of 24. Giving the variable a size of 25 and higher is unnecessary. Have you tested the code with a second player instead of on yourself?

Valid player names are between 3 and 20 characters. But MAX_PLAYER_NAME is set to 24.
Reply
#7

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
His code looks better than yours, tbh. It's easier to read through.
Quote:
Originally Posted by SickAttack
Посмотреть сообщение
That looks like if it was in a car crash.
Then let's set return 1; in every line with braces.......
Reply
#8

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
Then let's set return 1; in every line with braces.......
So what? I don't program like that myself, but it doesn't do any harm. In fact, it may even make it easier to analyze the code. Feel free to not do that, but don't hammer on someone who chooses to do it that way.
Reply
#9

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
Then let's set return 1; in every line with braces.......
It's easier to read than yours. You don't have to put return 1; on every "error" message, you could use "else if". But OP put it.
Reply
#10

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
So what? I don't program like that myself, but it doesn't do any harm. In fact, it may even make it easier to analyze the code. Feel free to not do that, but don't hammer on someone who chooses to do it that way.
I didn't hammer him dude but at last when he'll learn more about the scripting he'll obviously come to this same method which u just trying to defend.

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
It's easier to read than yours. You don't have to put return 1; on every "error" message, you could use "else if". But OP put it.
Your replies are worthless when you are leaning on 1 side. So #YouDontSay.

On topic: usama mere wala code use kro work kre ga bro.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)