argument type mismatch (argument 4)
#1

K:\WarHero source\gamemodes\Gamemode.pwn(5179) : error 035: argument type mismatch (argument 4)

Line:
pawn Код:
if(gettime() < PLAYER_TEMP[playerid][pt_LAST_PLANT_TIME] + 60)
    {
        new time = (60-(gettime()-PLAYER_TEMP[playerid][pt_LAST_PLANT_TIME]));
        ShowPlayerMessage(playerid, "Tienes que esperar %s minutos para volver a plantar.", 3, TimeConvert(time));
        return 1;
    }
Syntax: ShowPlayerMessage(playerid), "text", seconds;
Reply
#2

Well i mean your post answered your own question, the argument type isn't matching, maybe you're inserting a number into a string or a string into a boolean arg, just show us the ShowPlayerMessage function and I'll tell you where you went wrong. Its confusing cuz you're hinting towards it only having 3 parameters yet you're inserting 4, that's why its for the best to always show full code.
Reply
#3

pawn Код:
ShowPlayerMessage(playerid, message[], seconds = 0, sound = 0)
{
    KillTimer(PLAYER_TEMP[playerid][pt_TIMERS][17]);
   
    for(new len = strlen(message), pos; pos < len; pos ++)
    {
        switch(message[pos])
        {
            case 'а': message[pos] = 151;
            case 'б': message[pos] = 152;
            case 'в': message[pos] = 153;
            case 'д': message[pos] = 154;
            case 'А': message[pos] = 128;
            case 'Б': message[pos] = 129;
            case 'В': message[pos] = 130;
            case 'Д': message[pos] = 131;
            case 'и': message[pos] = 157;
            case 'й': message[pos] = 158;
            case 'к': message[pos] = 159;
            case 'л': message[pos] = 160;
            case 'И': message[pos] = 134;
            case 'Й': message[pos] = 135;
            case 'К': message[pos] = 136;
            case 'Л': message[pos] = 137;
            case 'м': message[pos] = 161;
            case 'н': message[pos] = 162;
            case 'о': message[pos] = 163;
            case 'п': message[pos] = 164;
            case 'М': message[pos] = 138;
            case 'Н': message[pos] = 139;
            case 'О': message[pos] = 140;
            case 'П': message[pos] = 141;
            case 'т': message[pos] = 165;
            case 'у': message[pos] = 166;
            case 'ф': message[pos] = 167;
            case 'ц': message[pos] = 168;
            case 'Т': message[pos] = 142;
            case 'У': message[pos] = 143;
            case 'Ф': message[pos] = 144;
            case 'Ц': message[pos] = 145;
            case 'щ': message[pos] = 169;
            case 'ъ': message[pos] = 170;
            case 'ы': message[pos] = 171;
            case 'ь': message[pos] = 172;
            case 'Щ': message[pos] = 146;
            case 'Ъ': message[pos] = 147;
            case 'Ы': message[pos] = 148;
            case 'Ь': message[pos] = 149;
            case 'с': message[pos] = 174;
            case 'С': message[pos] = 173;
            case 'Ў': message[pos] = 64;
            case 'ї': message[pos] = 175;
            case '`': message[pos] = 177;
            case '&': message[pos] = 38;
            default:  message[pos] = message[pos];
        }
    }
   
    PlayerTextDrawSetString(playerid, PlayerTextdraws[playerid][ptextdraw_MESSAGE], message);
    PlayerTextDrawShow(playerid, PlayerTextdraws[playerid][ptextdraw_MESSAGE]);
   
    if(seconds) PLAYER_TEMP[playerid][pt_TIMERS][17] = SetTimerEx("HidePlayerMessage", seconds * 1000, false, "i", playerid);
    if(sound) PlayerPlaySoundEx(playerid, sound, 0.0, 0.0, 0.0);
    return 1;
}

HidePlayerMessage(playerid);
public HidePlayerMessage(playerid)
{
    KillTimer(PLAYER_TEMP[playerid][pt_TIMERS][17]);
    PlayerTextDrawSetString(playerid, PlayerTextdraws[playerid][ptextdraw_MESSAGE], "_");
    PlayerTextDrawHide(playerid, PlayerTextdraws[playerid][ptextdraw_MESSAGE]);
    return 1;
}
Reply
#4

Okiedokie, now you'll need to show us the TimeConvert function as well
Reply
#5

pawn Код:
stock TimeConvert(seconds)
{
    new tmp[16];
    new minutes = floatround(seconds/60);
    seconds -= minutes*60;
    format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
    return tmp;
}
Reply
#6

There ya go buddy, you're inserting a string into a numeral parameter, so, to be brief, fixing this you'd go around by changing
pawn Код:
ShowPlayerMessage(playerid, message[], seconds = 0, sound = 0)
to
pawn Код:
ShowPlayerMessage(playerid, message[], seconds = 0, sound[] = "")
Or change the returned value from the TimeConvert function
Reply
#7

pawn Код:
new time = (60-(gettime()-PLAYER_TEMP[playerid][pt_LAST_PLANT_TIME])), string[144];
format(string, sizeof(string), "Tienes que esperar %s minutos para volver a plantar.", TimeConvert(time));
ShowPlayerMessage(playerid, string, 3);
Reply
#8

Thanks for the answers
+rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)