little help - 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: little help (
/showthread.php?tid=326245)
little help -
Dw.UsHer - 16.03.2012
how i make a cmd /accept invite and /decline invite ?? and how i make when leader type /giverank ID to change skin to member to the mafia etc. can any help me ?
Re: little help -
Alternative112 - 17.03.2012
Код:
new challengedPlayers[MAX_PLAYERS];
new challengers[MAX_PLAYERS];
dcmd_duel(playerid, params[]) {
new id = strval(params[0]);
challengers[playerid] = 1;
challengedPlayers[playerid] = 1;
SendClientMessage(id, 0x0000FF, "You have been challenged to a duel! Type /accept or decline.");
}
dcmd_accept(playerid, params[]) {
new id = params[0] //Challenger ID.
if (challengedPlayers[playerid] == 1 && IsPlayerConnected(playerid) && IsPlayerConnected(id)) {
//Start duel
}
}
dcmd_decline(playerid, params[]) {
new id = params[0] //Challenger ID.
challengedPlayers[playerid] = 0;
challengers[id] = 0;
SendClientMessage(id, 0xCC0000, "Your opponent refused your challenge.");
return 1;
}
This would require you to type /accept (ID) or /decline (ID). I did this quick and didn't include all the validation you should have, but it should push you in the right direction. I suggest you use /accept (id) instead of just /accept in case someone gets challenged twice before typing /accept or /decline...it would make things more difficult.