SA-MP Forums Archive
simple script - 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: simple script (/showthread.php?tid=392799)



simple script - MatZZPL - 15.11.2012

PHP код:
CMD:sellcar(playeridparams[])
{
    new 
targetid,type,string[128];
    if(
sscanf(params"ui"targetidtype)) return SendClientMessage(playeridCOLOR_GRAD2"INFO: {FFFFFF}/sellcar [playerid] [price]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_GREY"* This player is not online..");
    if(
type || type 99999999) return SendClientMessage(playeridCOLOR_GREY"* The minimum price is 0 and max price is 99999999.");
    if(
PlayerInfo[playerid][pVehOwned] < 1) return SendClientMessage(playeridCOLOR_GRAD1"You don't have a car!");
    new 
vehicle;
    
vehicle GetPlayerVehicleID(playerid);
    if(
PlayerInfo[playerid][pVeh1id] != vehicle) return SendClientMessage(playeridCOLOR_GRAD1"You are not in your car!");
    if(
PlayerInfo[targetid][pVehOwned] == 1) return SendClientMessage(playeridCOLOR_GRAD1"The person you are selling the car to, has too many of them!");
    
format(stringsizeof(string),"%s has offered you his car for $%d"RPNameplayerid ), type); 
This is what i done so far, now how could i make the "targetid" accept the offer? so for example say /accept car or "yes" or dialog pops up i dont know ;/ just need the person to accept it anyone? really really need it :/


Re: simple script - Azazelo - 15.11.2012

Quote:

#define DIALOG_CARSELL 9999 //on top

Quote:

ShowPlayerDialog(targetid, DIALOG_CARSELL, DIALOG_STYLE_MSGBOX, "Car sell", string, "Yes", "No"); // after has offered you his car

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])// under
{
if(dialogid == DIALOG_CARSELL)
{
if(response) // If they clicked 'Yes' or pressed enter
{
SendClientMessage(playerid, COLOR_GREEN, "Thank you for buying this car!");
}
else // Pressed ESC or clicked cancel
{
SendClientMessage(playerid, COLOR_RED, "You not accepted.");
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}

return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}

More info:
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse


Re: simple script - MatZZPL - 15.11.2012

I know ok, but now how am i gonna get the targetsid car details? This is my enum
PHP код:
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pSex,
    
pAge,
       
Float:pPos_x,
    
Float:pPos_y,
    
Float:pPos_z,
    
pSkin,
    
pTeam,
    
pAccent,
    
pPD,
    
pPrawko,
    
pKartaMotorowerowa,
    
pAutoBizness,
    
pUrzednik,
    
pJobs,
    
pDead,
    
pVeh1model,
    
pVeh1id,
    
pVeh1colour1,
    
pVeh1colour2,
    
Float:pVeh1_x,
    
Float:pVeh1_y,
    
Float:pVeh1_z,
    
pVehOwned,
    
Float:pTPos_x,
    
Float:pTPos_y,
    
Float:pTPos_z,
    
pVeh1spawned,
    
pVeh1spoiler,
    
pVeh1roof,
    
pVeh1hood,
    
pVeh1vents,
    
pVeh1sideskirts,
    
pVeh1rearbumper,
    
pVeh1frontbumper,
    
pVeh1exhaust,
    
pVeh1nitro,
    
pVeh1wheels,
    
pVeh1Health,
    
pVeh1tyres1,
    
pVeh1doors1,
    
pVeh1panels1,
    
pVeh1lights1,
    
pOffered,
    
pSeller

oh thats not the hard bit, i would be more about the fact that how is this dialog going to know the price that playerid has offered?


Re: simple script - MatZZPL - 15.11.2012

Anyone PLEASEEEE, been stuck with that for yearsssssss lol


Re: simple script - Faisal_khan - 16.11.2012

What do you mean by targetid's car details? Elaborate it more.


Re: simple script - MatZZPL - 16.11.2012

No i have the details, but i need the mechanic offer with the price, then if player accepts i can set the amout the fix will cost him?

Pretty much mechanics does /fixcar ID PRICE


then the ID gets and message "You have been offered to fix ur car for PRICE"

Then when ID says /accept mechanic or simply says anything to accept the offer it will take players money nd set mechanics money +PRICE


Re: simple script - MatZZPL - 16.11.2012

Anyone? Really need it


Re: simple script - MatZZPL - 16.11.2012

Does no one actually know? I can't believe i still can't do it :/


Re: simple script - MatZZPL - 16.11.2012

bump


Re: simple script - MatZZPL - 17.11.2012

BUMP, really need it :/