new WeaponInfo[][sWeaponInfo] = { {"Fist",1,0}, {"Shotgun",25,3}, {"Deagle",24,2} };
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; }
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} }; Код:
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; } |
weap = 24; weap2 = 31; weaponid = weap; weaponid = weap2; GivePlayerWeapon(playerid, weaponid, 1000);
duelinfo[playerid][weapid] = weaponid; duelinfo[playerid][weapname] = weap; duelinfo[playerid][weapname] = weap2; duelinfo[user][weapid] = weaponid; duelinfo[user][weapname] = weap; duelinfo[user][weapname] = weap2;
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 }
duelinfo[playerid][weapid] = weaponid;
duelinfo[playerid][weapid2] = weaponid;
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: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; }
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[user][weapid], 1000);
GivePlayerWeapon(playerid, duelinfo[user][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;
}
duelinfo[user][weapid] = weaponid;
GivePlayerWeapon(user, duelinfo[user][weapid], 1000);
GivePlayerWeapon(user, duelinfo[user][weapid2], 1000);
duelinfo[user][weapid] = weapid;
duelinfo[user][weapid2] = weapid2;