SA-MP Forums Archive
Why's this 'CallRemoteFunction' giving me a mismatch error? - 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's this 'CallRemoteFunction' giving me a mismatch error? (/showthread.php?tid=647926)



Why's this 'CallRemoteFunction' giving me a mismatch error? - Meller - 13.01.2018

Title, I don't see any issues using it..

PHP код:
CallRemoteFunction(return_callback"i"playerid); 
Full code;

fade.pwn
PHP код:
static PlayerText:playerFadeScreen[MAX_PLAYERS];
SetPlayerToFade(const playerid, const interval, const return_callback[]) {
    
PlayerTextDrawDestroy(playeridplayerFadeScreen[playerid]);
    
playerFadeScreen[playerid] = CreatePlayerTextDraw(playerid,0.0000000.000000"_");
    
PlayerTextDrawBackgroundColor(playeridplayerFadeScreen[playerid], 255);
    
PlayerTextDrawFont(playeridplayerFadeScreen[playerid], 1);
    
PlayerTextDrawLetterSize(playeridplayerFadeScreen[playerid], 0.50000064.000000);
    
PlayerTextDrawColor(playeridplayerFadeScreen[playerid], -1);
    
PlayerTextDrawSetOutline(playeridplayerFadeScreen[playerid], 0);
    
PlayerTextDrawSetProportional(playeridplayerFadeScreen[playerid], 1);
    
PlayerTextDrawSetShadow(playeridplayerFadeScreen[playerid], 1);
    
PlayerTextDrawUseBox(playeridplayerFadeScreen[playerid], 1);
    
PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000011);
    
PlayerTextDrawTextSize(playeridplayerFadeScreen[playerid], 640.0000000.000000);
    
PlayerTextDrawSetSelectable(playeridplayerFadeScreen[playerid], 0);
    
SetTimerEx("@OnPlayerRefreshScreen"interval/20false"iiis"playeridinterval/200return_callback);
}
forward @OnPlayerRefreshScreen(playeridintervalstagereturn_callback);
@
OnPlayerRefreshScreen(playeridintervalstagereturn_callback) {
    if(
stage 28) {
        if(
stage == 14)
            
CallRemoteFunction(return_callback"i"playerid);
        
SetTimerEx("@OnPlayerRefreshScreen"intervalfalse"iii"playeridintervalstage+1);
        switch(
stage) {
            case 
0PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000011);
            case 
1PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000022);
            case 
2PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000033);
            case 
3PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000044);
            case 
4PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000055);
            case 
5PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000066);
            case 
6PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000077);
            case 
7PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000088);
            case 
8PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000099);
            case 
9PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000AA);
            case 
10PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000BB);
            case 
11PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000CC);
            case 
12PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000DD);
            case 
13PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000EE);
            case 
14PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000FF);
            case 
15PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000EE);
            case 
16PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000DD);
            case 
17PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000CC);
            case 
18PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000BB);
            case 
19PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x000000AA);
            case 
20PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000099);
            case 
21PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000088);
            case 
22PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000077);
            case 
23PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000066);
            case 
24PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000055);
            case 
25PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000044);
            case 
26PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000033);
            case 
27PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000022);
            case 
28PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], 0x00000011);
        }
    }
    else
        
PlayerTextDrawDestroy(playeridplayerFadeScreen[playerid]);

And this is how I use it:

roleplay.pwn
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[]) {
    switch(
dialogid) {
        case 
DIALOG_LOGIN: {
            if(
response) {
                if(!
strempty(inputtext)) {
                    static 
password[256];
                    
SHA256_PassHash(inputtext"removed for samp forums"passwordsizeof password);
                    if(!
strcmp(passwordplayerData[playerid][playerPassword], false)) {
                        
playerData[playerid][playerActive] = true;
                        
SpawnPlayer(playerid);
                        
SetPlayerToFade(playerid2000"OnPlayerFinishFade");
                    }
                    else 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Lexus-Gaming: Roleplay""{A1C1D1}Welcome back,\n please enter your password below to login and play.\n \n"HEXWINE"Your credentials doesn't match up.""Submit""Cancel");
                }
                else 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Lexus-Gaming: Roleplay""{A1C1D1}Welcome back,\n please enter your password below to login and play.\n \n"HEXWINE"You must enter a password.""Submit""Cancel");
            }
            else {
                
SendClientMessage(playeridCOLOR_WINE"You've been kicked for the following reason..");
                
SendClientMessage(playeridCOLOR_WINE" - You failed to properly log in to your account.");
                
KickPlayer(playerid);
            }
            return 
1;
        }
    }
    return 
0;




Re: Why's this 'CallRemoteFunction' giving me a mismatch error? - rfr - 13.01.2018

PHP код:
CallRemoteFunction("return_callback""i"playerid); 



Re: Why's this 'CallRemoteFunction' giving me a mismatch error? - Meller - 13.01.2018

Quote:
Originally Posted by rfr
Посмотреть сообщение
PHP код:
CallRemoteFunction("return_callback""i"playerid); 
No, not really.. that would make the server call the callback called 'return_callback' and not the callback in the variable return_callback which is given upon calling 'SetPlayerToFade'.


Re: Why's this 'CallRemoteFunction' giving me a mismatch error? - OneDay - 13.01.2018

it should be a string:

PHP код:
forward @OnPlayerRefreshScreen(playeridintervalstage, const return_callback[]);
@
OnPlayerRefreshScreen(playeridintervalstage, const return_callback[]) { 
and:

PHP код:
SetTimerEx("@OnPlayerRefreshScreen"intervalfalse"iiis"playeridintervalstage+1return_callback); 



Re: Why's this 'CallRemoteFunction' giving me a mismatch error? - Meller - 13.01.2018

Quote:
Originally Posted by OneDay
Посмотреть сообщение
it should be a string:

PHP код:
forward @OnPlayerRefreshScreen(playeridintervalstage, const return_callback[]);
@
OnPlayerRefreshScreen(playeridintervalstage, const return_callback[]) { 
and:

PHP код:
SetTimerEx("@OnPlayerRefreshScreen"intervalfalse"iiis"playeridintervalstage+1return_callback); 
Oh yeah, totally missed that out! Thanks, bud.


Re: Why's this 'CallRemoteFunction' giving me a mismatch error? - OneDay - 13.01.2018

PHP код:
        static const stageColours[29] = {
            
0x000000110x000000220x000000330x000000440x000000550x000000660x00000077,
            
0x000000880x000000990x000000AA0x000000BB0x000000CC0x000000DD0x000000EE,
            
0x000000FF0x000000EE0x000000DD0x000000CC0x000000BB0x000000AA0x00000099,
            
0x000000880x000000770x000000660x000000550x000000440x000000330x00000022,
            
0x00000011 };
        
PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], stageColours[stage]);
        
// I think you need to show again
        
PlayerTextDrawShow(playeridplayerFadeScreen[playerid]); 



Re: Why's this 'CallRemoteFunction' giving me a mismatch error? - Meller - 13.01.2018

Quote:
Originally Posted by OneDay
Посмотреть сообщение
PHP код:
        static const stageColours[29] = {
            
0x000000110x000000220x000000330x000000440x000000550x000000660x00000077,
            
0x000000880x000000990x000000AA0x000000BB0x000000CC0x000000DD0x000000EE,
            
0x000000FF0x000000EE0x000000DD0x000000CC0x000000BB0x000000AA0x00000099,
            
0x000000880x000000770x000000660x000000550x000000440x000000330x00000022,
            
0x00000011 };
        
PlayerTextDrawBoxColor(playeridplayerFadeScreen[playerid], stageColours[stage]);
        
// I think you need to show again
        
PlayerTextDrawShow(playeridplayerFadeScreen[playerid]); 
Thanks bud, appreciate it.