15.10.2012, 16:56
pawn Код:
// Create this variable under the IsInIsland one.
new Skin[MAX_PLAYERS];
CMD:islanddm(playerid, params[])
{
if(IsInIsland[playerid]) return SendClientMessage(playerid, COLOR_RED,"You are already at the island!");
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
Skin[playerid] = GetPlayerSkin(playerid);
SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
format(string, sizeof(string), "{FF0000}(/islanddm) {FFFF00}Player {FF0000}%s {FFFF00}has Teleported to {FF0000}Island DeathMatch",pName);
SendClientMessageToAll(playerid, string);
new Random = random(sizeof(RandomSpawnIslandDM));
SetPlayerPos(playerid, RandomSpawnIslandDM[Random][0], RandomSpawnIslandDM[Random][1], RandomSpawnIslandDM[Random][2]);
IsInIsland[playerid] = 1;
return 1;
}
CMD:leavedm(playerid, params[])
{
if(!IsInIsland[playerid]) return SendClientMessage(playerid, COLOR_RED,"You are not at the island - /islanddm to join!");
new Random = random(sizeof(RandomSpawnLEAVEDM));
SetPlayerPos(playerid, RandomSpawnLEAVEDM[Random][0], RandomSpawnLEAVEDM[Random][1], RandomSpawnLEAVEDM[Random][2]); // Place the X Y Z of the position where they player will be when they type this command
SendClientMessage(playerid, COLOR_RED, "You have left the Deathmatch Area");
IsInIsland[playerid] = 0;
SetPlayerSkin(playerid, Skin[playerid]);
return 1;
}
// An example of making a restricted command that only works if not in the island.
CMD:vehicle(playerid, params[])
{
if(IsInIsland[playerid]) return SendClientMessage(playerid, COLOR_RED,"You can
t use this command while in the island!");
// Your code if he is not.
return 1;
}