question
#1

how do i know this cmd won't count user as someone else? let's say 30 ppl ig and it will count someone randomally as user

Код:
CMD:duelquit(playerid, params[])
{
  if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
  if(duelinfo[playerid][induel] == 0) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You're not in duel!");
  else
  {
		new user, str[128], name[MAX_PLAYER_NAME];
        duelinfo[playerid][induel] = 0;
        duelinfo[user][induel] = 0;
        invite[playerid] = 0;
        inviter[playerid] = 0;
        invite[user] = 0;
        inviter[user] = 0;
        SetPlayerArmour(playerid, 0);
        SetPlayerArmour(user, 0);
        SpawnPlayer(playerid);
        SpawnPlayer(user);
        GetPlayerName(playerid, name, sizeof(name));
        format(str, sizeof(str), "{c3c3c3}(DUEL) %s has left the duel!", name);
		SendClientMessageToAll(-1, str);
  }
  return 1;
}
or is it ok?
Reply
#2

You're checking if is player in duel. So it is correct code.

Also if you're spawning player then setting health and armour to 0 will just add player's death even person who didn't quit.
Let me tell you, spawn = Reset Health and Armour automatically, its just you're giving free deaths.
Reply
#3

who is "user" ? you haven't any variable for new user;
Reply
#4

Quote:
Originally Posted by Mugala
Посмотреть сообщение
who is "user" ? you haven't any variable for new user;
nope, should i add it in enum? but it might cause troubles mb idk
Reply
#5

Quote:
Originally Posted by Mugala
Посмотреть сообщение
who is "user" ? you haven't any variable for new user;
Quote:
Originally Posted by ivndosos
Посмотреть сообщение
nope, should i add it in enum? but it might cause troubles mb idk
enum is used for storing player data.

PHP код:
new user[MAX_PLAYER_NAME]; 
Reply
#6

you can SWAP player's IDs when they accept your duel system by command, you just have to add variables or just PVars for swapping.
for example at /accept command u must place:
SetPVarInt(playerid,"DuelerPlayerID",user);
SetPVarInt(user,"DuelerPlayerID",playerid);

and than u must use these params on this command - duelquit
user = GetPVarInt(playerid,"DuelerPlayerID");

Quote:
Originally Posted by KayJ
Посмотреть сообщение
enum is used for storing player data.
PHP код:
new user[MAX_PLAYER_NAME]; 
he doesn't uses "user" as player name, he's using this like player ID (targets in command)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)