#1

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;
}
Reply
#2

lol

add the 2nd weapon integer to sscanf:

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

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;
}
Reply
#4

it work thank you.
Reply
#5

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)