SA-MP Forums Archive
Ally cmd - 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: Ally cmd (/showthread.php?tid=518786)



Ally cmd - Battlezone - 11.06.2014

Hi, im making a cmd that allows 2 players from different teams to ally

pawn Код:
CMD:ally(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Usage: /ally [id].");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: The player you are trying to heal is not connected.");
    if(PlayerInfo[playerid][Team] == PlayerInfo[id][Team] && playerid == id) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You cannot ally with your team mates / yourself.");
    if(IsPlayerInDynamicCP(id, UCP) == 0 || IsPlayerInDynamicCP(playerid, UCP) == 0 ) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You or your ennemy must be in the united nations checkpoint.");
    new zstr[64];
    format(zstr, sizeof(zstr), " %s wants to ally with you", GetName(playerid));
    ShowPlayerDialog(playerid, ALLY, DIALOG_STYLE_MSGBOX, "Alliance demand", zstr, "Accept", "Decline");
    return 1;
}



public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case ALLY:
        {
                       // im stuck here, i have no ideas
                }
So im stuck in OnDialogResponse, i got an idea using variables but i think there is a way faster than that, any idea please? (rep+)