Why's this 'CallRemoteFunction' giving me a mismatch error?
#1

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(playerid, playerFadeScreen[playerid]);
    
playerFadeScreen[playerid] = CreatePlayerTextDraw(playerid,0.000000, 0.000000, "_");
    
PlayerTextDrawBackgroundColor(playerid, playerFadeScreen[playerid], 255);
    
PlayerTextDrawFont(playerid, playerFadeScreen[playerid], 1);
    
PlayerTextDrawLetterSize(playerid, playerFadeScreen[playerid], 0.500000, 64.000000);
    
PlayerTextDrawColor(playerid, playerFadeScreen[playerid], -1);
    
PlayerTextDrawSetOutline(playerid, playerFadeScreen[playerid], 0);
    
PlayerTextDrawSetProportional(playerid, playerFadeScreen[playerid], 1);
    
PlayerTextDrawSetShadow(playerid, playerFadeScreen[playerid], 1);
    
PlayerTextDrawUseBox(playerid, playerFadeScreen[playerid], 1);
    
PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000011);
    
PlayerTextDrawTextSize(playerid, playerFadeScreen[playerid], 640.000000, 0.000000);
    
PlayerTextDrawSetSelectable(playerid, playerFadeScreen[playerid], 0);
    
SetTimerEx("@OnPlayerRefreshScreen", interval/20, false, "iiis", playerid, interval/20, 0, return_callback);
}
forward @OnPlayerRefreshScreen(playerid, interval, stage, return_callback);
@
OnPlayerRefreshScreen(playerid, interval, stage, return_callback) {
    if(
stage < 28) {
        if(
stage == 14)
            
CallRemoteFunction(return_callback, "i", playerid);
        
SetTimerEx("@OnPlayerRefreshScreen", interval, false, "iii", playerid, interval, stage+1);
        switch(
stage) {
            case 
0: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000011);
            case 
1: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000022);
            case 
2: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000033);
            case 
3: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000044);
            case 
4: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000055);
            case 
5: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000066);
            case 
6: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000077);
            case 
7: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000088);
            case 
8: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000099);
            case 
9: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000AA);
            case 
10: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000BB);
            case 
11: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000CC);
            case 
12: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000DD);
            case 
13: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000EE);
            case 
14: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000FF);
            case 
15: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000EE);
            case 
16: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000DD);
            case 
17: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000CC);
            case 
18: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000BB);
            case 
19: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000AA);
            case 
20: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000099);
            case 
21: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000088);
            case 
22: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000077);
            case 
23: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000066);
            case 
24: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000055);
            case 
25: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000044);
            case 
26: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000033);
            case 
27: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000022);
            case 
28: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000011);
        }
    }
    else
        
PlayerTextDrawDestroy(playerid, playerFadeScreen[playerid]);
} 
And this is how I use it:

roleplay.pwn
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    switch(
dialogid) {
        case 
DIALOG_LOGIN: {
            if(
response) {
                if(!
strempty(inputtext)) {
                    static 
password[256];
                    
SHA256_PassHash(inputtext, "removed for samp forums", password, sizeof password);
                    if(!
strcmp(password, playerData[playerid][playerPassword], false)) {
                        
playerData[playerid][playerActive] = true;
                        
SpawnPlayer(playerid);
                        
SetPlayerToFade(playerid, 2000, "OnPlayerFinishFade");
                    }
                    else 
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_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(playerid, DIALOG_LOGIN, DIALOG_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(playerid, COLOR_WINE, "You've been kicked for the following reason..");
                
SendClientMessage(playerid, COLOR_WINE, " - You failed to properly log in to your account.");
                
KickPlayer(playerid);
            }
            return 
1;
        }
    }
    return 
0;
} 
Reply
#2

PHP код:
CallRemoteFunction("return_callback", "i", playerid); 
Reply
#3

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'.
Reply
#4

it should be a string:

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

PHP код:
SetTimerEx("@OnPlayerRefreshScreen", interval, false, "iiis", playerid, interval, stage+1, return_callback); 
Reply
#5

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

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

PHP код:
SetTimerEx("@OnPlayerRefreshScreen", interval, false, "iiis", playerid, interval, stage+1, return_callback); 
Oh yeah, totally missed that out! Thanks, bud.
Reply
#6

PHP код:
        static const stageColours[29] = {
            
0x00000011, 0x00000022, 0x00000033, 0x00000044, 0x00000055, 0x00000066, 0x00000077,
            
0x00000088, 0x00000099, 0x000000AA, 0x000000BB, 0x000000CC, 0x000000DD, 0x000000EE,
            
0x000000FF, 0x000000EE, 0x000000DD, 0x000000CC, 0x000000BB, 0x000000AA, 0x00000099,
            
0x00000088, 0x00000077, 0x00000066, 0x00000055, 0x00000044, 0x00000033, 0x00000022,
            
0x00000011 };
        
PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], stageColours[stage]);
        
// I think you need to show again
        
PlayerTextDrawShow(playerid, playerFadeScreen[playerid]); 
Reply
#7

Quote:
Originally Posted by OneDay
Посмотреть сообщение
PHP код:
        static const stageColours[29] = {
            
0x00000011, 0x00000022, 0x00000033, 0x00000044, 0x00000055, 0x00000066, 0x00000077,
            
0x00000088, 0x00000099, 0x000000AA, 0x000000BB, 0x000000CC, 0x000000DD, 0x000000EE,
            
0x000000FF, 0x000000EE, 0x000000DD, 0x000000CC, 0x000000BB, 0x000000AA, 0x00000099,
            
0x00000088, 0x00000077, 0x00000066, 0x00000055, 0x00000044, 0x00000033, 0x00000022,
            
0x00000011 };
        
PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], stageColours[stage]);
        
// I think you need to show again
        
PlayerTextDrawShow(playerid, playerFadeScreen[playerid]); 
Thanks bud, appreciate it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)