SA-MP Forums Archive
Why is this not working? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why is this not working? (/showthread.php?tid=611192)



Why is this not working? - MayaEU - 03.07.2016

Hello, if i join the server and use the newbiechat i will be show as "newbie" but when i reach level 3+ it should show me as "player", but it still show me as newbie, even if im level 10+
what is wrong?

pawn Код:
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
    {
        if(!PlayerInfo[playerid][pAdmin])
        {
            if(PlayerInfo[playerid][pNewbieBanned])
                return SendClientMessage(playerid, COLOR_GRAD2, " You are banned from using the newbie chat.");
        }
        strmid(tmp,cmdtext,idx,strlen(cmdtext));
        if(stringContainsIP(tmp))
            return SendClientMessage(playerid, COLOR_RED, "you cant adversite ip's here!");
        if(!strlen(tmp))
            return SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" (/n)ewbie [newbie chat]");
        // format string according to level and broadcas
        switch(NewbieHelper[playerid])
        {
            case 1: format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
            case 2: {
                    if(PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
                        format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
                    else
                        format(string, sizeof(string), "** Moderator %s:%s **",RemoveUnderScore(playerid),tmp);
                }
            case 3: {
                    if(PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
                        format(string, sizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
                    else
                        format(string, sizeof(string), "** Admin %s:%s **",RemoveUnderScore(playerid),tmp);
                }
            case 4: {
                    if(PlayerInfo[playerid][pLevel] >= 5 && !NewbieHelper[playerid])
                        format(string, sizeof(string), "** Player %s:%s **",RemoveUnderScore(playerid),tmp);
                    else
                        format(string, sizeof(string), "** Player %s:%s **",RemoveUnderScore(playerid),tmp);
                }
            default: format(string, sizeof(string), "** Newbie %s:%s **",RemoveUnderScore(playerid),tmp);
        }
        SendClientMessageToAll(COLOR_LIGHTGREEN,string);
        return 1;
    }



Re: Why is this not working? - MayaEU - 03.07.2016

i will rep+


Re: Why is this not working? - Dayrion - 03.07.2016

Quote:
Originally Posted by MayaEU
Посмотреть сообщение
i will rep+
I don't want it.

How you increase NewbieHelper[playerid] ? I mean this boolean? Integer variable ? This is weird.
PHP код:
switch(NewbieHelper[playerid]) 
So integer BUT
PHP код:
!NewbieHelper[playerid]) 
So what?


Re: Why is this not working? - SyS - 03.07.2016

please show the decalaration of NewbieHelper[playerid]
and debug it using printf as below and tell what is printing on log

PHP код:
if(strcmp(cmd"/newbie"true) == || strcmp(cmd"/n"true) == 0)
    {
        
if(!
PlayerInfo[playerid][pAdmin])
        {
            if(
PlayerInfo[playerid][pNewbieBanned])
                return 
SendClientMessage(playeridCOLOR_GRAD2" You are banned from using the newbie chat.");
        }
        
strmid(tmp,cmdtext,idx,strlen(cmdtext));
        if(
stringContainsIP(tmp))
            return 
SendClientMessage(playeridCOLOR_RED"you cant adversite ip's here!");
        if(!
strlen(tmp))
            return 
SendClientMessage(playeridCOLOR_GRAD2""COL_SZR"Usage:"COL_WHITE" (/n)ewbie [newbie chat]");
        
// format string according to level and broadcas
        
printf("[debug]newbie[playerid] = %d",NewbieHelper[playerid]);//hope that its a digit not boolean cause look down for more info
switch(NewbieHelper[playerid])
        {
            case 
1format(stringsizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
            case 
2: {
                    if(
PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
                        
format(stringsizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
                    else
                        
format(stringsizeof(string), "** Moderator %s:%s **",RemoveUnderScore(playerid),tmp);
                }
            case 
3: {
                    if(
PlayerInfo[playerid][pAdmin] & ADMIN_STEALTH)
                        
format(stringsizeof(string), "** Helper %s:%s **",RemoveUnderScore(playerid),tmp);
                    else
                        
format(stringsizeof(string), "** Admin %s:%s **",RemoveUnderScore(playerid),tmp);
                }
            case 
4: {
                    if(
PlayerInfo[playerid][pLevel] >= && !NewbieHelper[playerid])
                        
format(stringsizeof(string), "** Player %s:%s **",RemoveUnderScore(playerid),tmp);
                    else
                        
format(stringsizeof(string), "** Player %s:%s **",RemoveUnderScore(playerid),tmp);
                }
            default: 
format(stringsizeof(string), "** Newbie %s:%s **",RemoveUnderScore(playerid),tmp);
        }
        
SendClientMessageToAll(COLOR_LIGHTGREEN,string);
        return 
1;
    } 



Re: Why is this not working? - MayaEU - 03.07.2016

Also, i didnt make this command, i just tried to make that it says "player" when they are level 3+, it just doesnt work


Re: Why is this not working? - Dayrion - 03.07.2016

Quote:
Originally Posted by MayaEU
Посмотреть сообщение
Also, i didnt make this command, i just tried to make that it says "player" when they are level 3+, it just doesnt work
So you didn't make it. Anyway, this is in your gamemode ? Have you
PHP код:
NewbieHelper[playerid
In your gamemode?


Re: Why is this not working? - SyS - 03.07.2016

Quote:
Originally Posted by MayaEU
Посмотреть сообщение
Also, i didnt make this command, i just tried to make that it says "player" when they are level 3+, it just doesnt work
answer to above questions (i didnt see dayrion's post) how you declared the var is it boolean or integer?


Re: Why is this not working? - MayaEU - 03.07.2016

[debug]newbie[playerid] = 1


Re: Why is this not working? - SyS - 03.07.2016

Quote:
Originally Posted by MayaEU
Посмотреть сообщение
[debug]newbie[playerid] = 1
and the declaration have bool: tag?


Re: Why is this not working? - MayaEU - 03.07.2016

Well i dont know