CMD:moltdm(playerid, params[]) { new str[128]; if(UseDrug[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: Cannot teleport, Current using drugs!"); if(GetPlayerState(playerid) != 1 && GetPlayerState(playerid) != 2 && GetPlayerState(playerid) != 3 && GetPlayerState(playerid) != 7) return SendClientMessage(playerid, COLOR_RED, "[Spawned]: You must be spawned, To use this command!"); if(pInfo[playerid][Jail] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are in jail, You cannot teleport!"); if(InP[playerid] >= 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command while in Parkour!"); if(InHouse[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are inside the House, Cannot teleport!"); if(InDM[playerid] >= 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot teleport, You're in DM!"); if(God[playerid][0] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot go to TDM/DM during your God Protection is on, Please try again when it's off!"); if(pInfo[playerid][Freeze] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are frozen, Cannot use this command!"); if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot teleport while in Passenger seat!"); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "[Error]: You must be out of the vehicle before teleporting!"); timer[playerid][3] = SetTimerEx("LoadedObjects", 5000, false, "i", playerid); timer[playerid][4] = SetTimerEx("Protection", 4000, false, "i", playerid); new rand = random(sizeof(gRandomSpawns3)); SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid, 0); SetPlayerPos(playerid, gRandomSpawns3[rand][PlayerX], gRandomSpawns3[rand][PlayerY], gRandomSpawns3[rand][PlayerZ]); SetPlayerFacingAngle(playerid, gRandomSpawns3[rand][PlayerAngle]); ResetPlayerWeapons(playerid); GivePlayerWeapon(playerid, 18, 99999); TextDrawHideForPlayer(playerid, Textdraw5); TextDrawHideForPlayer(playerid, Textdraw4); SetPlayerArmour(playerid, 0.0); if(pInfo[playerid][VIP] >= 1) SetPlayerArmour(playerid, 100.0); SetPlayerVirtualWorld(playerid, 47); SetPlayerHealth(playerid, INFINITE); SendClientMessage(playerid, COLOR_YELLOW, "[LeaveDM]: /leavedm to leave the dm!"); format(str, sizeof(str), "[DM]: %s(%d) has joined the Molotov Deathmatch (/moltdm)", GetName(playerid), playerid); SendClientMessageToAll(COLOR_YELLOW, str); SendClientMessage(playerid, COLOR_GREY, "[Protection]: Spawn Protection will end in 4 seconds!"); InDM[playerid] = 7; return 1;
public OnPlayerSpawn(playerid)
{
switch (InDM[playerid])
{
case 0:
{
// set the normal spawnpoint
}
case 7:
{
// set the position for the /moltdm
}
}
return 1;
}
OnPlayerSpawn is a callback - don't search for it in your command!
pawn Код:
|