SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/05/2019, 09:45 PM   #11
KeyOfKey
Big Clucker
 
KeyOfKey's Avatar
 
Join Date: Apr 2019
Posts: 74
Reputation: 3
Default Re: Argument type mismatch

Nope it's worse if i move string = outside the loop, names are shown twice. Tried removing "WHITE" but same problem.
__________________
An alternative to PasteBin: CodeTainer
Encrypted pastes - Passworded pastes - Private pastes. All your pastes, in one place.
KeyOfKey is offline   Reply With Quote
Old 17/05/2019, 09:56 PM   #12
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 49
Reputation: 4
Default Re: Argument type mismatch

Wat.
Does this work?
Code:
function ListStaff(playerid)
{
    new rows = cache_num_rows(), pn[MAX_PLAYER_NAME], alvl, string[144], dialog[512];
    string = "Name\tStaff Level\tStatus";
    if(!rows) return 0; // no administrators found

    for(new i; i < rows; i ++)
    {
        cache_get_value(i, "Username", pn);
        cache_get_value_int(i, "AdminLevel", alvl);

        if(alvl)
        {
            new name[MAX_PLAYER_NAME],bool:connected;

            foreach(new j : Player)
            {
                GetPlayerName(j, name, sizeof(name)+1);
                if(!strcmp(name, pn)) connected = true;
            }
            
            if(connected) format(string, sizeof(string), "%s\n%s\t%d\t"GREEN"Online"WHITE, string, pn, alvl);
            else format(string, sizeof(string), "%s\n%s\t%d\t"RED"Offline"WHITE, string, pn, alvl);
            strcat(dialog, string);
            //print(string);
        }
    }
    //print(dialog);
    ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_TABLIST_HEADERS, "Staff", dialog, "Ok", "");
    return 1;
}
Optional prints to look what the string and dialog variable actually is.
That should work, it's the same way I do dialogs like this. o.O

//Edit
Oh, slipped my mind again, you don't need string you can do dialog[512]="..." and replace string with dialog and remove strcat.
Plastikmensch is offline   Reply With Quote
Old 18/05/2019, 01:46 PM   #13
KeyOfKey
Big Clucker
 
KeyOfKey's Avatar
 
Join Date: Apr 2019
Posts: 74
Reputation: 3
Default Re: Argument type mismatch



pawn Code:
function ListStaff(playerid)
{
    new rows = cache_num_rows(), pn[MAX_PLAYER_NAME], alvl, string[144], dialog[512];

    dialog = "Name\tStaff Level\tStatus";

    if(!rows) return 0; // no administrators found

    for(new i; i < rows; i ++)
    {
        cache_get_value(i, "Username", pn);
        cache_get_value_int(i, "AdminLevel", alvl);

        if(alvl)
        {
            new name[MAX_PLAYER_NAME],bool:connected;

            foreach(new j : Player)
            {
                GetPlayerName(j, name, sizeof(name)+1);
                if(!strcmp(name, pn)) connected = true;
            }

            if(connected) format(dialog, sizeof(dialog), "%s\n%s\t%d\t"GREEN"Online"WHITE, dialog, pn, alvl);
            else format(dialog, sizeof(dialog), "%s\n%s\t%d\t"RED"Offline"WHITE, string, pn, alvl);
        }
    }
    ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_TABLIST_HEADERS, "LSS-RP Staff", dialog, "Ok", "");
    return 1;
}
__________________
An alternative to PasteBin: CodeTainer
Encrypted pastes - Passworded pastes - Private pastes. All your pastes, in one place.
KeyOfKey is offline   Reply With Quote
Old 18/05/2019, 01:59 PM   #14
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 49
Reputation: 4
Default Re: Argument type mismatch

You didn't change string to dialog here:
(You can also remove string[144] in the third line since you don't need the variable.)
pawn Code:
else format(dialog, sizeof(dialog), "%s\n%s\t%d\t"RED"Offline"WHITE, string, pn, alvl);
Should work after that. (Empty strings as an argument in format leads to unexpected results)
Plastikmensch is offline   Reply With Quote
Old 18/05/2019, 02:01 PM   #15
KeyOfKey
Big Clucker
 
KeyOfKey's Avatar
 
Join Date: Apr 2019
Posts: 74
Reputation: 3
Default Re: Argument type mismatch

Finally. Thank you for your patience.
__________________
An alternative to PasteBin: CodeTainer
Encrypted pastes - Passworded pastes - Private pastes. All your pastes, in one place.
KeyOfKey is offline   Reply With Quote
Old 18/05/2019, 02:04 PM   #16
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 49
Reputation: 4
Default Re: Argument type mismatch

No problem I am happy it works now
Plastikmensch is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assistance Needed | error 035: argument type mismatch (argument 2) KevTheJoker Scripting Help 4 14/01/2019 09:29 PM
D:\server\gamemodes\ExtremeGame.pwn(22326) : error 035: argument type mismatch (argument 2) enzulikeS Scripting Help 2 25/04/2018 03:38 PM
C:\Users\Lirbo\Desktop\Roleplay\gamemodes\ERP.pwn( 19) : error 035: argument type mismatch (argument 1) Lirbo Scripting Help 2 12/12/2014 02:51 PM
argument type mismatch (argument type 2) on sendclientmessage? Jack_Leslie Help Archive 2 31/07/2011 05:12 AM


All times are GMT. The time now is 06:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.