SA-MP Forums Archive
Problem with /rejectoffer command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with /rejectoffer command (/showthread.php?tid=529274)



Problem with /rejectoffer command - IceBilizard - 01.08.2014

Guys i have a script with that players can sell vehicles to another players so players can reject,accept, and car owner can cancel offer all commands working perfect if player id 1 offered me his car so when i type /rejectoffer 1 its saying unknown command

here is the code

pawn Код:
CMD:rejectoffer(playerid,params[])
{
    new id,str[128],str1[128],offerdname[MAX_PLAYER_NAME],offringname[MAX_PLAYER_NAME];
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /rejectoffer [playerid]");
    if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_RED,"Errro: Invalid player id!");
    if(dini_Int(pFile(playerid),"offeredby") ==-1) return SendClientMessage(playerid,COLOR_RED,"Error: That player did not offered you their car!");

    GetPlayerName(playerid,offringname,sizeof(offringname));
    GetPlayerName(id,offerdname,sizeof(offerdname));

    format(str,128,"%s has rejected the offered of his %s with you.",offringname,VehicleNames[GetVehicleModel(PlayerInfo[playerid][Car]) - 400]);
    SendClientMessage(id,COLOR_RED,str);

    format(str1,128,"You have rejected the offer with %s for your %s.",offerdname,VehicleNames[GetVehicleModel(PlayerInfo[playerid][Car]) - 400]);
    SendClientMessage(playerid,COLOR_ORANGE,str1);

    dini_IntSet(pFile(playerid),"offeredby",-1);
    dini_IntSet(pFile(id),"offeredto",-1);

    return 1;
}
but when i remove
pawn Код:
VehicleNames[GetVehicleModel(PlayerInfo[playerid][Car]) - 400]
from /rejectoffer command its working and i want to add this because i want to add vehicle name of player in command please help me


Re: Problem with /rejectoffer command - Sanguy - 01.08.2014

Perhaps you could try
Код:
VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]
I have no idea if this will work, or whether this line is even the problem since I do not know what the rest of the script looks like.


Re: Problem with /rejectoffer command - IceBilizard - 01.08.2014

i fixed my self just did
thx for your comment
pawn Код:
VehicleNames[GetVehicleModel(PlayerInfo[id][Car]