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

So i have the same line with "playerid" instead of "giveplayer" and there is no error,only on this line:
Код:
GivePlayerMoney(giveplayer, RepairPrice[playerid]);
(error 035: argument type mismatch (argument 1))

Do you know what is problem?
So i know that giveplayer is string,but how can i add him money?

Код:
COMMAND:prihvatipopravku(playerid, params[])
{
    If(RepairOffer[playerid] < 999)
    {
            If(GetPlayerMoney(playerid) > RepairPrice[playerid])
	        {
	            If(IsPlayerInAnyVehicle(playerid))
       			{
					new sendername[MAX_PLAYER_NAME];
				 	new RepairCar[MAX_PLAYERS];
					new giveplayer[MAX_PLAYER_NAME],string[256];
					GetPlayerName(RepairOffer[playerid], giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					RepairCar[playerid] = GetPlayerVehicleID(playerid);
					RepairVehicle(RepairCar[playerid]);
					format(string, sizeof(string), "{0049FF}[Popravka] {FFFFFF}Vase auto je popravljeno za $%d od strane mehanicara %s.",RepairPrice[playerid],giveplayer);
					SCM(playerid, PLAVA, string);
					format(string, sizeof(string), "{0049FF}[Popravka] {FFFFFF}Popravio si %s-ovo auto za $%d.",sendername,RepairPrice[playerid]);
					SCM(RepairOffer[playerid], PLAVA, string);
					//SafeGivePlayerMoney(giveplayer, RepairPrice[playerid]);
					SafeGivePlayerMoney(playerid, -RepairPrice[playerid]);
					RepairOffer[playerid] = 999;
					RepairPrice[playerid] = 0;
					Return 1;
                }
            }
	        Else Return SCM(playerid, CRVENA, "{00A6FF}divClient: {FFFFFF}Nemas dovoljno novca.");
    }
	Return 1;
}
Reply
#2

as you already stated right, you cant enter a string parameter, when an integer value is expected.
Try smth. like this:


pawn Код:
//Will "convert" the string/players name into his ID
if(FindPlayersID(giveplayer)!= -1)
{
    new name[MAX_PLAYERS][24];
    foreach(Player,ii)
    {
        GetPlayerName(ii,name[ii],24);
        if(strfind(name[ii],giveplayer, true) == 0)
        {
            GivePlayerMoney(ii, RepairPrice[ii]);
        }
    }
}
//stock
stock FindPlayersID(name[])
{
    new Pname[24];
    foreach(Player,i)
    {
        GetPlayerName(i, Pname, 24);
        if(!strcmp(Pname, name, true))return i;
    }
    return -1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)