argument type mismatch (argument 1) -
Brandon_More - 02.12.2013
Errors:
Код:
(21927) : error 035: argument type mismatch (argument 1)
(21928) : error 035: argument type mismatch (argument 1)
pawn Код:
COMMAND:house(playerid, params[])
{
new tmpid=IsPlayerOutHouse(playerid), tmp[ 15 ], tmp2, filename[ 20 ], owner[ MAX_PLAYER_NAME ];
if(tmpid == -1) return SendClientError(playerid, "You are not standing at any house!");
format(filename, 20, "Casa%d.txt", tmpid);
myStrcpy(owner, dini_Get(filename, "owner"));
if(strcmp(owner, PlayerName(playerid), false) && PlayerInfo[playerid][power] < 10) return SendClientError(playerid, "You don't own this house!");
if(sscanf(params, "sz", tmp, tmp2)) return SCP(playerid, "[upgrade / dupekey / help]");
if(!strcmp(tmp, "upgrade", true, 5))
{
new iString[ 1512 ];
for(new i=1;i<sizeof(interiorpack);i++)
{
new canheal[4],canarmor[4];
if(interiorpack[i][_heal]) myStrcpy(canheal,"Yes"); else myStrcpy(canheal,"No");
if(interiorpack[i][_armor]) myStrcpy(canarmor,"Yes"); else myStrcpy(canarmor,"No");
format(iStr,sizeof(iStr),"InteriorID:[%d] \tHeal:[%s] \tArmour:[%s] \tPrice[$%s]\n",interiorpack[i][_intid],canheal,canarmor, number_format(interiorpack[i][_packprice]));
strcat(iString,iStr);
}
ShowPlayerDialog(playerid, 40, DIALOG_STYLE_LIST, "** House Interior Packs **",iString, "/house upgrade", "");
return 1;
}
//==============================================================================
else if(!strcmp(tmp, "dupekey", true, 7))
{
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "dupekey [playerid]"); // <<--- Error is here
new giveplayerid = strval(tmp2); // <<--- Error is here
if(!IsPlayerConnected(giveplayerid)) return SendClientError(playerid, "Player not found!");
if(GetDistanceBetweenPlayers(playerid, giveplayerid) > 10)
return SendClientError(playerid, "He is too far away!");
for(new r=0; r<sizeof(House);r++)
{
new nomefile[ 24 ];
format(nomefile,sizeof(nomefile),"Houses/Casa%d.txt",House[r][HouseID]);
dini_Set(nomefile, "dupekey", PlayerName(giveplayerid));
myStrcpy(House[r][dupekey], PlayerName(giveplayerid));
format(iStr, sizeof(iStr),"has given the keys of their house to %s.", MaskedName(giveplayerid));
Action(playerid, iStr);
format(iStr, sizeof(iStr), "6[HOUSE] %s has given their house dupe-key to %s.", PlayerName(playerid), PlayerName(giveplayerid));
iEcho(iStr);
}
}
//==============================================================================
else if(!strcmp(tmp, "help", true, 4))
{
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/buyhouse, /sellhouse [price], /unsellhouse. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/rentprice [amount], /open, /close. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/unrent - Cancel renting at a house. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/house upgrade - Allows you to upgrade your house interior. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/till withdraw/deposit - Manage the till balance of your house. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/tenants - show a list of people who rent at your house. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/evict - evict a tenant from renting at your house. {228B22}]");
}
else return SCP(playerid, "[alarm / upgrade / dupekey / help]");
return 1;
}
Re: argument type mismatch (argument 1) - Emmet_ - 02.12.2013
Here. "tmp2" was an integer when it should be an array.
pawn Код:
COMMAND:house(playerid, params[])
{
new tmpid=IsPlayerOutHouse(playerid), tmp[ 15 ], tmp2[24], filename[ 20 ], owner[ MAX_PLAYER_NAME ];
if(tmpid == -1) return SendClientError(playerid, "You are not standing at any house!");
format(filename, 20, "Casa%d.txt", tmpid);
myStrcpy(owner, dini_Get(filename, "owner"));
if(strcmp(owner, PlayerName(playerid), false) && PlayerInfo[playerid][power] < 10) return SendClientError(playerid, "You don't own this house!");
if(sscanf(params, "sz", tmp, tmp2)) return SCP(playerid, "[upgrade / dupekey / help]");
if(!strcmp(tmp, "upgrade", true, 5))
{
new iString[ 1512 ];
for(new i=1;i<sizeof(interiorpack);i++)
{
new canheal[4],canarmor[4];
if(interiorpack[i][_heal]) myStrcpy(canheal,"Yes"); else myStrcpy(canheal,"No");
if(interiorpack[i][_armor]) myStrcpy(canarmor,"Yes"); else myStrcpy(canarmor,"No");
format(iStr,sizeof(iStr),"InteriorID:[%d] \tHeal:[%s] \tArmour:[%s] \tPrice[$%s]\n",interiorpack[i][_intid],canheal,canarmor, number_format(interiorpack[i][_packprice]));
strcat(iString,iStr);
}
ShowPlayerDialog(playerid, 40, DIALOG_STYLE_LIST, "** House Interior Packs **",iString, "/house upgrade", "");
return 1;
}
//==============================================================================
else if(!strcmp(tmp, "dupekey", true, 7))
{
if(!strlen(tmp2) || !IsNumeric(tmp2) || strlen(tmp2) > 5) return SCP(playerid, "dupekey [playerid]"); // <<--- Error is here
new giveplayerid = strval(tmp2); // <<--- Error is here
if(!IsPlayerConnected(giveplayerid)) return SendClientError(playerid, "Player not found!");
if(GetDistanceBetweenPlayers(playerid, giveplayerid) > 10)
return SendClientError(playerid, "He is too far away!");
for(new r=0; r<sizeof(House);r++)
{
new nomefile[ 24 ];
format(nomefile,sizeof(nomefile),"Houses/Casa%d.txt",House[r][HouseID]);
dini_Set(nomefile, "dupekey", PlayerName(giveplayerid));
myStrcpy(House[r][dupekey], PlayerName(giveplayerid));
format(iStr, sizeof(iStr),"has given the keys of their house to %s.", MaskedName(giveplayerid));
Action(playerid, iStr);
format(iStr, sizeof(iStr), "6[HOUSE] %s has given their house dupe-key to %s.", PlayerName(playerid), PlayerName(giveplayerid));
iEcho(iStr);
}
}
//==============================================================================
else if(!strcmp(tmp, "help", true, 4))
{
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/buyhouse, /sellhouse [price], /unsellhouse. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/rentprice [amount], /open, /close. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/unrent - Cancel renting at a house. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/house upgrade - Allows you to upgrade your house interior. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/till withdraw/deposit - Manage the till balance of your house. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/tenants - show a list of people who rent at your house. {228B22}]");
SendClientMessage(playerid, COLOR_WHITE, "{228B22}[ {FFFFFF}/evict - evict a tenant from renting at your house. {228B22}]");
}
else return SCP(playerid, "[alarm / upgrade / dupekey / help]");
return 1;
}
Re: argument type mismatch (argument 1) -
Brandon_More - 02.12.2013
Thanks man, woked REP++