12.11.2015, 08:40
How to make when a player types /dmarena that he cannot type it againt if he is already in the arena?
PHP код:
CMD:dmarena(playerid, params[])
{
InDM[playerid] = 1; // we declared him in the DM arena.
GameTextForPlayer(playerid, "/napustidm da izades iz DM arene!", 3000, 4); // a little game text to tell him how to exit if he's bored from the arena.
SendClientMessage(playerid, -1, "{66FF66}Dobrodosao u DM arenu! {BABABA}"); // Welcoming him to the arena..
new c = random(3);
if (c == 0){
SetPlayerPos(playerid, -1128.71, 1057.77, 1346.41);}
else if (c == 1){
SetPlayerPos(playerid, -1038.03, 1036.85, 1341.35);}
else if (c == 2){
SetPlayerPos(playerid, -971.10, 1061.41, 1345.02);}
SetPlayerInterior(playerid, 10);
SetPlayerVirtualWorld(playerid, 1);
SetPlayerTeam(playerid, playerid); // setting every player in a team, since every one has a unique playerid
ResetPlayerWeapons(playerid); // removing his weapons from outside the arena
SetPlayerColor(playerid, COLOR_WHITE); // setting everyone's color to white, u can change it
SetPlayerSkin(playerid, 167); // setting his funny skin
SetPlayerHealth(playerid, 100); // 100 for the health
SetPlayerArmour(playerid, 100); // 100 armour
GivePlayerWeapon(playerid, 26, cellmax);
GivePlayerWeapon(playerid, 28, cellmax);
GivePlayerWeapon(playerid, 24, cellmax);
GivePlayerWeapon(playerid, 34, cellmax);
GivePlayerWeapon(playerid, 16, 2); // we gave him the weapons here.
new str[200], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "{FFFFFF}%s {BABABA}(ID: %d) se teleportirao u DM arenu! Pridruzi mu se koristeci /dmarena !", name, playerid);
SendClientMessageToAll(-1, str);// we just announced to everyone that he entered the arena
return 1;
}
CMD:napustidm(playerid, params[])
{
if(InDM[playerid] == 0)
{
SendClientMessage(playerid, -1, "Nisi u DM areni!");
return 1;
}
else if(InDM[playerid] == 1)
{
InDM[playerid] = 0;
SetPlayerVirtualWorld(playerid, 0);
SetPlayerHealth(playerid, 0.00);
ForceClassSelection(playerid);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, -1, "Napustio si DM arenu!!");
return 1;
}
return 1;
}