03.04.2009, 19:26
I need help creating a dm with random respawns on death
I made this, but it doesn't work
I made this, but it doesn't work
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new IsPlayerInDM[MAX_PLAYERS]; if ((strcmp("/dm1", cmdtext, true, 10) == 0)&&(IsPlayerInDM[playerid] == 0)) { new pName[MAX_PLAYER_NAME]; new string[256]; IsPlayerInDM[playerid] = 1; GetPlayerName(playerid, pName, sizeof(pName)); format(string, sizeof(string), "%s has entered dm1. Type /dm1 to pwn him", pName); SendClientMessageToAll(0xFFFFAEFF, string); SetPlayerPos(playerid, -379.5638,2222.6265,42.0938); SetPlayerArmour(playerid, 100.00); GivePlayerWeapon(playerid, 6, 500); GivePlayerWeapon(playerid, 26, 500); GivePlayerWeapon(playerid, 32, 500); GivePlayerWeapon(playerid, 41, 500); SetPlayerWorldBounds(playerid, -331.0740,-472.8714,2282.5764, 2141.8994); return 1; } { public OnPlayerSpawn(playerid) new IsPlayerInDM[MAX_PLAYERS]; if (IsPlayerInDM[playerid] == 1) { new c = random(2); //random respawn if (c == 0){ SetPlayerPos(playerid,-366.4124,2268.1926,42.3083);} else if (c == 1){ SetPlayerPos(playerid, -336.1055,2198.8230,45.5047);} else if (c == 2){ SetPlayerPos(playerid, -423.1209,2190.5198,42.0999);} else { SetPlayerPos(playerid, -447.9061,2265.9319,45.8330);} } }