pass command to dialog
#1


if someone can help me to pass this command to dialog, I thank you


PHP код:
CMD:repair(playeridparams[])
{
    if(
IsPlayerInRangeOfPoint(playerid20.02180.9875,-1979.7583,13.5606)) //Optional - CHANGE
    
{
        new 
string[128], item[32], pIDmName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        if(
sscanf(params"s[32] "item)) {
            
SendClientMessage(playerid, -1"USAGE: /repair [option]");
            
SendClientMessage(playerid, -1"Options: bodykit, engine");
            return 
1;
        }
        if(
strcmp(item,"bodykit",true) == 0) {
            if (
sscanf(params"s[32]u"itempID)) return SendClientMessage(playerid, -1"USAGE: /repair bodykit [ID/Name]");
            
GetPlayerName(playeridmNamesizeof(mName));
            
GetPlayerName(pIDpNamesizeof(pName));
            
format(stringsizeof(string), "%s has offered you a repair of bodykit on your car!"mName);
            
SendClientMessage(pIDCOLOR_LIGHTBLUEstring);
            
SendClientMessage(pIDCOLOR_LIGHTBLUE"Use: /acceptmeh to accept that offer!");
            
format(stringsizeof(string), "You offered %s to repair bodykit on his vehicle."pName);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            
Service[pID][1] = 1;
        }
        else if(
strcmp(item,"engine",true) == 0) {
            if(
sscanf(params"s[32]u",itempID)) return SendClientMessage(playerid, -1"USAGE: /repair engine [ID/Name]");
            
GetPlayerName(playeridmNamesizeof(mName));
            
GetPlayerName(pIDpNamesizeof(pName));
            
format(stringsizeof(string), "%s has offered you a repair of engine on your vehicle!"mName);
            
SendClientMessage(pIDCOLOR_LIGHTBLUEstring);
            
SendClientMessage(pIDCOLOR_LIGHTBLUE"Use: /acceptmeh to accept that offer!");
            
format(stringsizeof(string), "You offered %s to repair engine on his vehicle."pName);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            
Service[pID][2] = 1;
        }
    }
    else return 
SendClientMessage(playeridCOLOR_RED"You must be in the garage to repair vehicles!");
    return 
1;

Reply
#2

you can start and post up your errors or mistakes, community will give you some help.

you must save player's choice for example engine will be value 2 and bodykit will be value 1.
than you must save playerid, which offered repair. (later this saved choices and saved playerid will be used in OnPlayerDialogResponse)
you can simply save these 2 variables with SetPVarInt (https://sampwiki.blast.hk/wiki/SetPVarInt)

here is a links that you'll need
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/Dialog_Styles
https://sampwiki.blast.hk/wiki/OnDialogResponse
https://sampwiki.blast.hk/wiki/GetPVarInt
Reply
#3

Don't use PVars.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)