duel sys
#1

The duel system I downloaded was originally suppose to be with 1 weapon selection only!

So I tried to make it 2 weapon

(e.g: /duel id weap1 weap2)

and for some reason I don't get the second weapon

Код:
new WeaponInfo[][sWeaponInfo] =
{
    {"Fist",1,0},
    {"Shotgun",25,3},
    {"Deagle",24,2}

};
p.s the weap2[85] is the custom one I made yeah.

Код:
CMD:duel(playerid, params[])
{
    new user, weap[85],weap2[85], weaponid = -1, string[128], string2[128] ;
    if(sscanf(params, "uss[90]", user, weap, weap2)) return SendClientMessage(playerid, -1, "{00cc00}(INFO) /duel [id] [weapon1] [weapon2]");
    if(user == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is offline!");
    if(user == playerid) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You can't duel yourself!");
    if(duelinfo[playerid][induel] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You're already in a duel!");
    if(duelinfo[user][induel] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is already dueling somebody!");
    if(invite[user] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player has already received a duel invitation!");
    if(inviter[playerid] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have already invited someone! (/cancelrequest) to cancel the invitation!)");
    if(StringNumeric(weap))
    {
        weaponid = strval(weap);
    }
    if(StringNumeric(weap2))
    {
        weaponid = strval(weap2);
	}
    else
    {
        weaponid = CheckWeaponID(weap);
        weaponid = CheckWeaponID(weap2);
    }
    DuelSender[user] = playerid;
    duelinfo[playerid][weapid] = weaponid;
    duelinfo[playerid][weapname] = weap;
    duelinfo[playerid][weapname] = weap2;
    duelinfo[user][weapid] = weaponid;
    duelinfo[user][weapname] = weap;
    duelinfo[user][weapname] = weap2;
    invite[user] = 1;
    inviter[playerid] = 1;
    DuelReciever[playerid] = user;
    format(string, sizeof(string), "{00CC00}(DUEL) You have sent a duel invitation to %s (Weapon: %s and %s)", duelinfo[user][playername], user, weap, weap2);
    SendClientMessage(playerid, -1, string);
    format(string2, sizeof(string2), "{00cc00}(DUEL) You have received a duel invitation from %s(ID:%d) (Weapon: %s and %s) (/accept, /decline)", duelinfo[playerid][playername], playerid, weap, weap2);
    SendClientMessage(user, -1, string2);
    return 1;
}
CMD:accept(playerid, params[])
{
    if(invite[playerid] == 1)
    {
        new user = DuelSender[playerid];
        ResetPlayerWeapons(user);
        RemovePlayerFromVehicle(user);
        SetPlayerArmour(user, 100);
        SetPlayerHealth(user, 100);
        SetPlayerVirtualWorld(user, 100);
        SetPlayerPos(user, 1266.6100,2729.2917,10.8203);
        GivePlayerWeapon(user, duelinfo[playerid][weapid], 1000);
        GivePlayerWeapon(playerid, duelinfo[playerid][weapid], 1000);
        duelinfo[user][induel] = 1;
        inviter[user] = 0;

        ResetPlayerWeapons(playerid);
        RemovePlayerFromVehicle(playerid);
        SetPlayerArmour(playerid, 100);
        SetPlayerHealth(playerid, 100);
        SetPlayerVirtualWorld(playerid, 100);
        GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);
        GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);
        SetPlayerPos(playerid, 1272.0603,2857.6536,10.8203);
        duelinfo[playerid][induel] = 1;
        invite[playerid] = 0;
    }
    else return SendClientMessage(playerid, -1, "{c3c3c3}(DUEL) You didn't recieve any duel request");
    return 1;
}
Reply
#2

Quote:
Originally Posted by ivndosos
Посмотреть сообщение
The duel system I downloaded was originally suppose to be with 1 weapon selection only!

So I tried to make it 2 weapon

(e.g: /duel id weap1 weap2)

and for some reason I don't get the second weapon

Код:
new WeaponInfo[][sWeaponInfo] =
{
    {"Fist",1,0},
    {"Shotgun",25,3},
    {"Deagle",24,2}

};
p.s the weap2[85] is the custom one I made yeah.

Код:
CMD:duel(playerid, params[])
{
    new user, weap[85],weap2[85], weaponid = -1, string[128], string2[128] ;
    if(sscanf(params, "uss[90]", user, weap, weap2)) return SendClientMessage(playerid, -1, "{00cc00}(INFO) /duel [id] [weapon1] [weapon2]");
    if(user == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is offline!");
    if(user == playerid) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You can't duel yourself!");
    if(duelinfo[playerid][induel] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You're already in a duel!");
    if(duelinfo[user][induel] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is already dueling somebody!");
    if(invite[user] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player has already received a duel invitation!");
    if(inviter[playerid] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have already invited someone! (/cancelrequest) to cancel the invitation!)");
    if(StringNumeric(weap))
    {
        weaponid = strval(weap);
    }
    if(StringNumeric(weap2))
    {
        weaponid = strval(weap2);
	}
    else
    {
        weaponid = CheckWeaponID(weap);
        weaponid = CheckWeaponID(weap2);
    }
    DuelSender[user] = playerid;
    duelinfo[playerid][weapid] = weaponid;
    duelinfo[playerid][weapname] = weap;
    duelinfo[playerid][weapname] = weap2;
    duelinfo[user][weapid] = weaponid;
    duelinfo[user][weapname] = weap;
    duelinfo[user][weapname] = weap2;
    invite[user] = 1;
    inviter[playerid] = 1;
    DuelReciever[playerid] = user;
    format(string, sizeof(string), "{00CC00}(DUEL) You have sent a duel invitation to %s (Weapon: %s and %s)", duelinfo[user][playername], user, weap, weap2);
    SendClientMessage(playerid, -1, string);
    format(string2, sizeof(string2), "{00cc00}(DUEL) You have received a duel invitation from %s(ID:%d) (Weapon: %s and %s) (/accept, /decline)", duelinfo[playerid][playername], playerid, weap, weap2);
    SendClientMessage(user, -1, string2);
    return 1;
}
CMD:accept(playerid, params[])
{
    if(invite[playerid] == 1)
    {
        new user = DuelSender[playerid];
        ResetPlayerWeapons(user);
        RemovePlayerFromVehicle(user);
        SetPlayerArmour(user, 100);
        SetPlayerHealth(user, 100);
        SetPlayerVirtualWorld(user, 100);
        SetPlayerPos(user, 1266.6100,2729.2917,10.8203);
        GivePlayerWeapon(user, duelinfo[playerid][weapid], 1000);
        GivePlayerWeapon(playerid, duelinfo[playerid][weapid], 1000);
        duelinfo[user][induel] = 1;
        inviter[user] = 0;

        ResetPlayerWeapons(playerid);
        RemovePlayerFromVehicle(playerid);
        SetPlayerArmour(playerid, 100);
        SetPlayerHealth(playerid, 100);
        SetPlayerVirtualWorld(playerid, 100);
        GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);
        GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);
        SetPlayerPos(playerid, 1272.0603,2857.6536,10.8203);
        duelinfo[playerid][induel] = 1;
        invite[playerid] = 0;
    }
    else return SendClientMessage(playerid, -1, "{c3c3c3}(DUEL) You didn't recieve any duel request");
    return 1;
}
You use a var (weaponid) to store in it 2 other values (weap, weap2).

YOU CAN'T TO THIS.
Код:
weap = 24;
weap2 = 31;

weaponid = weap;
weaponid = weap2;

GivePlayerWeapon(playerid, weaponid, 1000);
YOU WILL LOSE A VAR. In this case just weap2 will be stored.

Integrate vars for each one. Create 2 vars duelinfo[user][weapid1] and duelinfo[user][weapid2], and so on...

This is wrong.
Код:
    duelinfo[playerid][weapid] = weaponid;
    duelinfo[playerid][weapname] = weap;
    duelinfo[playerid][weapname] = weap2;
    duelinfo[user][weapid] = weaponid;
    duelinfo[user][weapname] = weap;
    duelinfo[user][weapname] = weap2;
Reply
#3

Did you mean like that? Because I haven't really understood you.

Код:
    DuelSender[user] = playerid;
    duelinfo[playerid][weapid] = weaponid;
    duelinfo[playerid][weapid2] = weaponid;
    duelinfo[playerid][weapname] = weap;
    duelinfo[playerid][weapname] = weap2;
    duelinfo[user][weapid] = weaponid;
    duelinfo[user][weapid2] = weaponid;
    duelinfo[user][weapname] = weap;
    duelinfo[user][weapname] = weap2;
Код:
enum DuelSystem
{
        playername[25],
        induel,
        weapname[85],
        weapid,
        weapid2
}
Reply
#4

PHP код:
    duelinfo[playerid][weapid] = weaponid;
    
duelinfo[playerid][weapid2] = weaponid
this is wrong.you assign the same value to 2 variables,use weaponid and weaponid2
Reply
#5

add weaponid 2 in the command variables.
add weapname2 in the duelinfo enums.
add weapid2 in duelinfo enums.

edit this
duelinfo[user][weapname] = weap;
duelinfo[user][weapname] = weap2;

into this
duelinfo[user][weapname] = weap;
duelinfo[user][weapname2] = weap2; //(weapname2)


and edit this
weaponid = CheckWeaponID(weap);
weaponid = CheckWeaponID(weap2);

into this
weaponid = CheckWeaponID(weap);
weaponid2 = CheckWeaponID(weap2);


replace ResetPlayerWeapons(playerid); in command: accept
place it at the ResetPlayerWeapons(user);

edit this
GivePlayerWeapon(user, duelinfo[playerid][weapid], 1000);
GivePlayerWeapon(playerid, duelinfo[playerid][weapid], 1000);

into this
GivePlayerWeapon(user, duelinfo[playerid][weapid], 1000);
GivePlayerWeapon(user, duelinfo[playerid][weapid2], 1000);


and edit this
GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);
GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);

into this
GivePlayerWeapon(playerid, duelinfo[user][weapid], 1000);
GivePlayerWeapon(playerid, duelinfo[user][weapid2], 1000);


also, add duelinfo[playerid][weapid2] = weaponid2; in /duel command.
Reply
#6

There's a little issue,

Код:
    format(string, sizeof(string), "{00CC00}(DUEL) You have sent a duel invitation to %s (Weapon: %s and %s)", duelinfo[user][playername], user, weap, weap2);
    SendClientMessage(playerid, -1, string);
    format(string2, sizeof(string2), "{00cc00}(DUEL) You have received a duel invitation from %s(ID:%d) (Weapon: %s and %s) (/accept, /decline)", duelinfo[playerid][playername], playerid, weap, weap2);
    SendClientMessage(user, -1, string2);
    return 1;
}
When I send someone duel he sees (weapons: deagle and shotgun)

but when it shows me the message eg. u invited this blah blah with weapons: , shotgun

it doesn't show the first weapon
Reply
#7

bump ^ that issue and

if i invite someone, i get 2 weapons but he gets 1

Код:
CMD:duel(playerid, params[])
{
    new user, weap[85],weap2[85], weaponid = -1, weaponid2 = -1,string[250], string2[250] ;
    if(sscanf(params, "uss[128]", user, weap, weap2)) return SendClientMessage(playerid, -1, "{00cc00}(INFO) /Duel [ID/Player Name] [Weapon Name 1] [Weapon Name 2]");
    if(user == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is offline!");
    if(user == playerid) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You can't duel yourself!");
    if(duelinfo[playerid][induel] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You're already in a duel!");
    if(duelinfo[user][induel] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is already dueling somebody!");
    if(invite[user] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player has already received a duel invitation!");
    if(IsPlayerInLobby[user] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is in lobby!");
    if(InArena1[user] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) That player is in arena!");
    if(inviter[playerid] == 1) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have already invited someone! (/cancelrequest) to cancel the invitation!)");
    if(StringNumeric(weap))
    {
        weaponid = strval(weap);
    }
    if(StringNumeric(weap2))
    {
        weaponid = strval(weap2);
	}
    else
    {
	weaponid = CheckWeaponID(weap);
	weaponid2 = CheckWeaponID(weap2);
    }
    duelinfo[playerid][weapid2] = weaponid2;
    DuelSender[user] = playerid;
    duelinfo[playerid][weapid] = weaponid;
    duelinfo[playerid][weapname] = weap;
    duelinfo[playerid][weapname2] = weap2;
    duelinfo[user][weapid] = weaponid;
	duelinfo[user][weapname] = weap;
	duelinfo[user][weapname2] = weap2;
    invite[user] = 1;
    inviter[playerid] = 1;
    DuelReciever[playerid] = user;
    format(string, sizeof(string), "{00CC00}(DUEL) You have sent a duel invitation to %s (with %s and %s)", duelinfo[user][playername], weap, weap2);
    SendClientMessage(playerid, -1, string);
    format(string2, sizeof(string2), "{00cc00}(DUEL) You have received a duel invitation from %s(ID:%d) (with %s and %s) (/accept, /decline)", duelinfo[playerid][playername], playerid, weap, weap2);
    SendClientMessage(user, -1, string2);
    return 1;
}

CMD:accept(playerid, params[])
{
    if(invite[playerid] == 1)
    {
        new user = DuelSender[playerid];
        ResetPlayerWeapons(user);
        RemovePlayerFromVehicle(user);
        SetPlayerArmour(user, 100);
        SetPlayerHealth(user, 100);
        SetPlayerVirtualWorld(user, 100);
        SetPlayerPos(user, 1266.6100,2729.2917,10.8203);
        GivePlayerWeapon(user, duelinfo[user][weapid], 1000);
		GivePlayerWeapon(user, duelinfo[user][weapid2], 1000);
        duelinfo[user][induel] = 1;
        inviter[user] = 0;

        ResetPlayerWeapons(playerid);
        RemovePlayerFromVehicle(playerid);
        SetPlayerArmour(playerid, 100);
        SetPlayerHealth(playerid, 100);
        SetPlayerVirtualWorld(playerid, 100);
        GivePlayerWeapon(playerid, duelinfo[playerid][weapid], 1000);
		GivePlayerWeapon(playerid, duelinfo[playerid][weapid2], 1000);
        SetPlayerPos(playerid, 1272.0603,2857.6536,10.8203);
        duelinfo[playerid][induel] = 1;
        invite[playerid] = 0;
    }
    else return SendClientMessage(playerid, -1, "{c3c3c3}(DUEL) You didn't recieve any duel request.");
    return 1;
}
Reply
#8

change GivePlayerWeapon(playerid,duelinfo[playerid][weapid],1000) and GivePlayerWeapon(playerid,duelinfo[playerid][weapid2],1000)

to GivePlayerWeapon(playerid,duelinfo[user][weapid],1000) and GivePlayerWeapon(playerid,duelinfo[user][weapid],1000)

like this
PHP код:
CMD:accept(playeridparams[])
{
    if(
invite[playerid] == 1)
    {
        new 
user DuelSender[playerid];
        
ResetPlayerWeapons(user);
        
RemovePlayerFromVehicle(user);
        
SetPlayerArmour(user100);
        
SetPlayerHealth(user100);
        
SetPlayerVirtualWorld(user100);
        
SetPlayerPos(user1266.6100,2729.2917,10.8203);
        
GivePlayerWeapon(userduelinfo[user][weapid], 1000);
        
GivePlayerWeapon(userduelinfo[user][weapid2], 1000);
        
duelinfo[user][induel] = 1;
        
inviter[user] = 0;
        
ResetPlayerWeapons(playerid);
        
RemovePlayerFromVehicle(playerid);
        
SetPlayerArmour(playerid100);
        
SetPlayerHealth(playerid100);
        
SetPlayerVirtualWorld(playerid100);
        
GivePlayerWeapon(playeridduelinfo[user][weapid], 1000);
        
GivePlayerWeapon(playeridduelinfo[user][weapid2], 1000);
        
SetPlayerPos(playerid1272.0603,2857.6536,10.8203);
        
duelinfo[playerid][induel] = 1;
        
invite[playerid] = 0;
    }
    else return 
SendClientMessage(playerid, -1"{c3c3c3}(DUEL) You didn't recieve any duel request.");
    return 
1;

Reply
#9

you`ve got this
PHP код:
duelinfo[user][weapid] = weaponid
and then you give User thisweapons
PHP код:
GivePlayerWeapon(userduelinfo[user][weapid], 1000);
        
GivePlayerWeapon(userduelinfo[user][weapid2], 1000); 
so add this instead of the first line i mentioned
PHP код:
duelinfo[user][weapid] = weapid;
duelinfo[user][weapid2] = weapid2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)