SA-MP Forums Archive
OnPlayerClickPlayer, +REP. - 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: OnPlayerClickPlayer, +REP. (/showthread.php?tid=483144)



OnPlayerClickPlayer, +REP. - DemME - 24.12.2013

Hey guys, I've tried to do when player clicks another player dialog will pop out, anyway I got the following error.

Quote:

C:\Documents and Settings\user\Desktop\Gamemode\Vane\gamemodes\vrp. pwn(31808) : error 029: invalid expression, assumed zero

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new string[64];
    new string2[128];
    new ranktext[32];
    (Line: 31808) - if(PlayerInfo[clickedplayerid][pHelper] == 1 &&  == 0){ ranktext = "Helper"; }
    if(PlayerInfo[clickedplayerid][pAdmin] == 2 &&  == 0){ ranktext = "Administrator"; }
    if(PlayerInfo[clickedplayerid][pAdmin] == 2 &&  == 0){ ranktext = "Administrator"; }
    if(PlayerInfo[clickedplayerid][pAdmin] == 3 &&  == 0){ ranktext = "Lead Administrators"; }
    if(PlayerInfo[clickedplayerid][pAdmin] == 6 &&  == 0){ ranktext = "Head Administrators"; }
    else { ranktext = "Civilian"; }
    if(clickedplayerid == playerid)
    {
        format(string, sizeof(string), "Player Info: %s", RPN);
        format(string2, sizeof(string2), "Name: %s\nRank: %s\nLevel: %d\n Paycheck Time(60): %d", RPN(clickedplayerid),ranktext,PlayerInfo[clickedplayerid][pLevel], PlayerInfo[clickedplayerid][pMinutes]);
        ShowPlayerDialog(playerid, 99, DIALOG_STYLE_MSGBOX, string, string2, "Ok","");
    } else {
        format(string, sizeof(string), "Player Info: %s", RPN);
        format(string2, sizeof(string2), "Name: %s\nRank: %s\nLevel: %d", RPN(clickedplayerid),ranktext,PlayerInfo[clickedplayerid][pLevel]);
        ShowPlayerDialog(playerid, 99, DIALOG_STYLE_MSGBOX, string, string2, "Ok","");
    }
    return 1;
}
Thats all the public, can you tell me please whats the problem?


Re: OnPlayerClickPlayer, +REP. - Kells - 24.12.2013

show line number : 31808
so i can help


Re: OnPlayerClickPlayer, +REP. - iZN - 24.12.2013

Use strval.

pawn Код:
if(PlayerInfo[clickedplayerid][pHelper] == 1 &&  == 0){ ranktext = strval("Helper"); }



Re: OnPlayerClickPlayer, +REP. - SilentSoul - 24.12.2013

Also , why you used && == 0 that's mean if his admin rank equal to 0 , you need to change to '&& PlayerInfo[clickedplayer][Admin]!=0' which means not equal too. also its useless checking your variable will be check once the player is level 1 only.


Re: OnPlayerClickPlayer, +REP. - DemME - 24.12.2013

Quote:
Originally Posted by iZN
Посмотреть сообщение
Use strval.

pawn Код:
if(PlayerInfo[clickedplayerid][pHelper] == 1 &&  == 0){ ranktext = strval("Helper"); }
pawn Код:
C:\Documents and Settings\user\Desktop\Gamemode\Vane\gamemodes\vrp.pwn(31808) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\Gamemode\Vane\gamemodes\vrp.pwn(31808) : warning 215: expression has no effect
C:\Documents and Settings\user\Desktop\Gamemode\Vane\gamemodes\vrp.pwn(31808) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\user\Desktop\Gamemode\Vane\gamemodes\vrp.pwn(31808) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\Gamemode\Vane\gamemodes\vrp.pwn(31808) : fatal error 107: too many error messages on one line
31808 Line

pawn Код:
if(PlayerInfo[clickedplayerid][pHelper] == 1 &&  == 0){ ranktext = strval("Helper"); }



Re: OnPlayerClickPlayer, +REP. - SilentSoul - 24.12.2013

Try changing to
pawn Код:
if(PlayerInfo[clickedplayerid][pHelper] == 1)
{
ranktext = "Helper";
}
Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Also , why you used && == 0 that's mean if his admin rank equal to 0 , you need to change to '&& PlayerInfo[clickedplayer][Admin]!=0' which means not equal too. also its useless checking your variable will be check once the player is level 1 only.



Re: OnPlayerClickPlayer, +REP. - Pottus - 24.12.2013

Must be a nightmare script to work with having that many lines in a single file anyways.

pawn Код:
if(PlayerInfo[clickedplayerid][pHelper] == 1){ ranktext = "Helper"; }
    else if(PlayerInfo[clickedplayerid][pAdmin] == 2){ ranktext = "Administrator"; }
    else if(PlayerInfo[clickedplayerid][pAdmin] == 2){ ranktext = "Administrator"; }
    else if(PlayerInfo[clickedplayerid][pAdmin] == 3){ ranktext = "Lead Administrators"; }
    else if(PlayerInfo[clickedplayerid][pAdmin] == 6){ ranktext = "Head Administrators"; }