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



duel - ScRipTeRi - 03.01.2014

hello i have make one duel system but now i am try to do it with /duel playerid [weapon] [weapon]
and i make it but i got one problem when start duel he give just one weapon
i will show you a litle code of my duel
pawn Код:
CMD:duel(playerid, params[])
{
if(sscanf(params,"ud", id, weaponid1, weaponid2)) return SendClientMessage(playerid, 0xF41917AA, "USAGE: /duel [playerid] [weaponid] [weaponid]");if(sscanf(params,"ud", id, weaponid1, weaponid2)) return SendClientMessage(playerid, 0xF41917AA, "USAGE: /duel [playerid] [weaponid] [weaponid]");
}

forward GoDuel(playerid,id);
public GoDuel(playerid,id)
{
ResetPlayerWeapons(playerid);
ResetPlayerWeapons(id);
GivePlayerWeapon(playerid, weaponid1, 999);
GivePlayerWeapon(playerid, weaponid2, 999);
GivePlayerWeapon(id, weaponid1, 999);
GivePlayerWeapon(id, weaponid2, 999);
return 1;
}



Re: duel - driftg0d - 03.01.2014

lol

add the 2nd weapon integer to sscanf:

Код:
if(sscanf(params,"udd", id, weaponid1, weaponid2))



Re: duel - Patrick - 03.01.2014

I have created a new and better duel system, because as stated above you're missing a specifier, also you are missing a parameter on GoDuel callback, it will give you an error
Код:
error 017: undefined symbol "weaponid1"
error 017: undefined symbol "weaponid1"
error 017: undefined symbol "weaponid2"
error 017: undefined symbol "weaponid2"
My Version
pawn Код:
CMD:duel(playerid, params[])
{
    new
        otherid,
        weaponid[2]
    ;
    if( sscanf ( params, "udd", otherid, weaponid[0], weaponid[1] ) )
    {
        return SendClientMessage(playerid, -1, "USAGE: /duel [playerid] [weaponid] [weaponid]");
    }
    else if(otherid == INVALID_PLAYER_ID)
    {
        return SendClientMessage(playerid, -1, "ERROR: Invalid playerid");
    }
    return ExecuteDuel(playerid, otherid, weaponid[0], weaponid[1]);
}

stock ExecuteDuel(playerid, otherid, weaponid1, weaponid2)
{
    ResetPlayerWeapons(playerid), ResetPlayerWeapons(otherid),
    GivePlayerWeapon(playerid, weaponid1, 999), GivePlayerWeapon(playerid, weaponid2, 999),
    GivePlayerWeapon(otherid, weaponid1, 999), GivePlayerWeapon(otherid, weaponid2, 999);
    return true;
}



Re: duel - ScRipTeRi - 03.01.2014

it work thank you.


Re: duel - driftg0d - 03.01.2014

glad it did, pm me or post here in forums if you have any other doubt.


Re: duel - ScRipTeRi - 03.01.2014

yes i have and somthing for player can't use weapon id 38 how to do it?


Re: duel - driftg0d - 04.01.2014

must be your anticheat, try adding an exception to weapon id 38 (i think it's the minigun)