error 035: argument type mismatch (argument 1)
#1

C:\UsersDownloads\gm.pwn(12892) : error 035: argument type mismatch (argument 1)


Line: 12892:
Quote:

giveplayerid = ReturnUser(playerid, tmp);

Full Command:
Quote:

dcmd_crimes(playerid, params[])
{
#pragma unused params

if (PlayerInfo[playerid][pSpawn] == 1){

if (PlayerInfo[playerid][pTeam] == TEAM_CIVILIAN){

new string[256],Wanted[128],idx,giveplayerid,tmp[256];


tmp = strtok(params, idx);
if(!strlen(tmp))
{
//SendClientMessage(playerid, COLOR_ERROR, "USAGE: /crimes (Name/Id).");
//return 1;
giveplayerid = playerid;
}else{

if(!isNumeric(tmp))
{
giveplayerid = ReturnUser(playerid, tmp);
if(giveplayerid == INVALID_PLAYER_ID)
{
return 1;
}
}
else
{
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "%d Is Not A Valid ID.", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
}
}

switch (PlayerInfo[giveplayerid][pWantedLevel])
{
case 0:format(string, sizeof(string), "Wated Level %d - Innocent Civilian",PlayerInfo[giveplayerid][pWantedLevel]);
case 1..5:format(string, sizeof(string), "~y~Wated Level %d",PlayerInfo[giveplayerid][pWantedLevel]);
case 6..10:format(string, sizeof(string), "~r~Wated Level %d",PlayerInfo[giveplayerid][pWantedLevel]);
}
strmid(Wanted, string, 0, strlen(string), 256);

if(PlayerCrimeListRowNo[giveplayerid] > 0)
{

TextDrawHideForPlayer(playerid, Menu_Title[playerid]);
TextDrawHideForPlayer(playerid, Menu_Stats[playerid]);
TextDrawHideForPlayer(playerid, Menu_End[playerid]);
for(new r = 0; r < MAX_TEXTDRAW_ROWS; r++)
{
TextDrawHideForPlayer(playerid, Menu_Column1[playerid][r]);
TextDrawHideForPlayer(playerid, Menu_Column2[playerid][r]);
}

ShowTextDrawMenu(playerid, TD_MENU_INFO,"~g~Crime History", PlayerCrimeListRowNo[giveplayerid] + 5, 0);
//ShowTextDrawMenuItems(playerid, 0, " ", " ", " ",0);
format(string, sizeof(string), "%s (%d)~n~%s",PlayerInfo[giveplayerid][pName],giveplayerid,Wanted);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0);
//ShowTextDrawMenuItems(playerid, 3, " ", Line[0], LineEx[0],0);
ShowTextDrawMenuItems(playerid, 4, " ", PlayerCrimeList[playerid][1], " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", PlayerCrimeList[playerid][2], " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", PlayerCrimeList[playerid][3], " ",0);
ShowTextDrawMenuItems(playerid, 7, " ", PlayerCrimeList[playerid][4], " ",0);
ShowTextDrawMenuItems(playerid, 8, " ", PlayerCrimeList[playerid][5], " ",0);
ShowTextDrawMenuItems(playerid, 9, " ", PlayerCrimeList[playerid][6], " ",0);
ShowTextDrawMenuItems(playerid, 10, " ", PlayerCrimeList[playerid][7], " ",0);
ShowTextDrawMenuItems(playerid, 11, " ", PlayerCrimeList[playerid][8], " ",0);
ShowTextDrawMenuItems(playerid, 12, " ", PlayerCrimeList[playerid][9], " ",0);

}else{

format(string, sizeof(string), "No Crimes Committed By %s (%d).",PlayerInfo[giveplayerid][pName],giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);

}



}else{
SendClientMessage(playerid, COLOR_ERROR, "Only Civilians Can Use This Command.");
}

}else{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
}

return 1;
}

I would be your thankful if you explain what is it. Actually, I left scripting but im back again so i forgot everything. Nvm it. I like to know what is it and also how to fix it. Thank you.
Reply
#2

Check
Quote:

ReturnUser(text[]) {

is in that script or not
Reply
#3

strtok and ReturnUser are really old and slow methods for that. The best option is sscanf.
Same applies for dcmd. ZCMD and y_commands are faster methods.

And all you'd have to do is:
PHP код:
CMD:crimes(playeridparams[])
{
    if (
PlayerInfo[playerid][pSpawn] != 1) return SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    if (
PlayerInfo[playerid][pTeam] != TEAM_CIVILIAN) return SendClientMessage(playeridCOLOR_ERROR"Only Civilians Can Use This Command.");
    
    new 
giveplayerid;
    if (
isnull(params)) giveplayerid playerid;
    else if (!
sscanf(params"r"giveplayerid))
    {
        if (
giveplayerid == INVALID_PLAYER_ID)
        {
            new 
string[23];
            
format(stringsizeof(string), "%d Is Not A Valid ID."giveplayerid);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
    }
    
    new 
string[100];
    switch (
PlayerInfo[giveplayerid][pWantedLevel])
    {
        case 
0format(stringsizeof(string), "Wated Level %d - Innocent Civilian"PlayerInfo[giveplayerid][pWantedLevel]);
        case 
.. 5format(stringsizeof(string), "~y~Wated Level %d"PlayerInfo[giveplayerid][pWantedLevel]);
        case 
.. 10format(stringsizeof(string), "~r~Wated Level %d"PlayerInfo[giveplayerid][pWantedLevel]);
    }
    
    if(
PlayerCrimeListRowNo[giveplayerid] > 0)
    {
        
        
TextDrawHideForPlayer(playeridMenu_Title[playerid]);
        
TextDrawHideForPlayer(playeridMenu_Stats[playerid]);
        
TextDrawHideForPlayer(playeridMenu_End[playerid]);
        
        for(new 
0MAX_TEXTDRAW_ROWSr++)
        {
            
TextDrawHideForPlayer(playeridMenu_Column1[playerid][r]);
            
TextDrawHideForPlayer(playeridMenu_Column2[playerid][r]);
        }
        
        
ShowTextDrawMenu(playeridTD_MENU_INFO,"~g~Crime History"PlayerCrimeListRowNo[giveplayerid] + 50);
        
//ShowTextDrawMenuItems(playerid, 0, " ", " ", " ",0);
        
        
format(stringsizeof(string), "%s (%d)~n~%s"PlayerInfo[giveplayerid][pName], giveplayeridstring);
        
        
ShowTextDrawMenuItems(playerid0string" "" ",0);
        
ShowTextDrawMenuItems(playerid1" "" "" ",0);
        
ShowTextDrawMenuItems(playerid2" "" "" ",0);
        
ShowTextDrawMenuItems(playerid3" "" "" ",0);
        
//ShowTextDrawMenuItems(playerid, 3, " ", Line[0], LineEx[0],0);
        
ShowTextDrawMenuItems(playerid4" "PlayerCrimeList[playerid][1], " "0);
        
ShowTextDrawMenuItems(playerid5" "PlayerCrimeList[playerid][2], " "0);
        
ShowTextDrawMenuItems(playerid6" "PlayerCrimeList[playerid][3], " "0);
        
ShowTextDrawMenuItems(playerid7" "PlayerCrimeList[playerid][4], " "0);
        
ShowTextDrawMenuItems(playerid8" "PlayerCrimeList[playerid][5], " "0);
        
ShowTextDrawMenuItems(playerid9" "PlayerCrimeList[playerid][6], " "0);
        
ShowTextDrawMenuItems(playerid10" "PlayerCrimeList[playerid][7], " "0);
        
ShowTextDrawMenuItems(playerid11" "PlayerCrimeList[playerid][8], " "0);
        
ShowTextDrawMenuItems(playerid12" "PlayerCrimeList[playerid][9], " "0);
    }
    else
    {
        
format(stringsizeof(string), "No Crimes Committed By %s (%d)."PlayerInfo[giveplayerid][pName], giveplayerid);
        
SendClientMessage(playeridCOLOR_ERRORstring);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)