13.03.2015, 23:00
(
Последний раз редактировалось HailPutin; 13.03.2015 в 23:31.
)
Ok im new at scripting im just modifying a gamemode currently so i gain more experience
I made this dm command but have 2 problems with it,If you die you are not spawning in dm area ( it respawns in base) and the other one is that you still have same team before you joined dm and I don't know how i would set another team for it.
Here is the code i made:
I made this dm command but have 2 problems with it,If you die you are not spawning in dm area ( it respawns in base) and the other one is that you still have same team before you joined dm and I don't know how i would set another team for it.
Here is the code i made:
Код:
new Float:DMSpawns[][4] = { //Dm spawns {-974.3079,1061.1146,1345.6755,88.2162}, {-1052.9237,1024.6133,1343.1317,355.4687}, {-1063.7754,1096.8344,1343.1486,183.7607}, {-1132.2988,1057.7354,1346.4117,268.4739} }; new InDM[MAX_PLAYERS];
Код:
OnPlayerConnect { // dm InDM[playerid] = 0; return 1; } OnPlayerDisconnect { //dm InDM[playerid] = 0; return 1; }
Код:
OnPlayerSpawn { if(InDM[playerid] == 1) { SetPlayerInterior(playerid, 10); SetPlayerVirtualWorld(playerid, 10); new rand = random(sizeof(DMSpawns)); SetPlayerPos(playerid, DMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]); SetPlayerFacingAngle(playerid, DMSpawns[rand][3]); SetPlayerArmour(playerid, 99); SetPlayerHealth(playerid,99); GivePlayerWeapon(playerid, 24, 1500); // Desert Eagle GivePlayerWeapon(playerid, 27, 1500); // Combat Shotgun GivePlayerWeapon(playerid, 34, 1500); // Sniper GivePlayerWeapon(playerid, 31, 1500); // M4 } return 1; }
Код:
CMD:dm(playerid, params[]) { new string[128]; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); if(InDM[playerid] == 0) { InDM[playerid] = 1; SendClientMessage(playerid, COLOR_ORANGE , "You have joined /dm, to leave type /dm again"); format(string, sizeof(string), "Server: {FFFFFF}%s(%d) has joined DM(/dm)", PlayerName, playerid); SendClientMessageToAll(COLOR_LIGHTBLUE, string); SetPlayerInterior(playerid, 10); SetPlayerVirtualWorld(playerid, 10); new rand = random(sizeof(DMSpawns)); SetPlayerPos(playerid, DMSpawns[rand][0], DMSpawns[rand][1], DMSpawns[rand][2]); SetPlayerFacingAngle(playerid, DMSpawns[rand][3]); SetPlayerArmour(playerid, 99); SetPlayerHealth(playerid,99); GivePlayerWeapon(playerid, 24, 1500); // Desert Eagle GivePlayerWeapon(playerid, 27, 1500); // Combat Shotgun GivePlayerWeapon(playerid, 34, 1500); // Sniper GivePlayerWeapon(playerid, 31, 1500); // M4 } else { InDM[playerid] = 0; SendClientMessage(playerid, COLOR_ORANGE, "You have left /dm to join again type /dm"); SetPlayerHealth(playerid, 0); SetPlayerVirtualWorld(playerid, 0); ForceClassSelection(playerid); } return 1; }