27.07.2017, 20:16
If I'm not wrong, this is what you want?
PHP код:
COMMAND:west(playerid, params)
{
new PlayerName[MAX_PLAYER_NAME];//Player name
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(InDM[playerid] == 0)//if the player is not in DM
{//then
InDM[playerid] = 1; // Now we will set him in DM so he will respawn at DM
SendClientMessage(playerid, COLOR_LIGHTBLUE , "You have joined /west, to leave type /west again");//Message to tell him that he joined DM
format(String, sizeof(String), "Server:{FFFFFF}%s(%d) has joined (/west)", PlayerName, playerid);
SendClientMessageToAll(COLOR_LIGHTBLUE, String);//Message to tell everyone that he joined DM
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid, 0); // we will set he's interior to 0
SetPlayerVirtualWorld(playerid, 10); // and same here Virtual World to 10
new rand = random(sizeof(DMSpawns)); // DM Spawn
SetPlayerPos(playerid,2245.5874,-8967.5977,11.3574);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Old West Gunfights!");
GivePlayerWeapon(playerid,24,500);
GivePlayerWeapon(playerid,25,200);
GivePlayerWeapon(playerid,33,200);
GivePlayerWeapon(playerid,4,0);
}
else {//if the player is already in DM, he will leave
InDM[playerid] = 0; //So now we will set him as not in DM
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have left /west to join again type /west");//We will send him a message to tell him that he left
SpawnPlayer(playerid);//We will spawn the player now
SetPlayerHealth(playerid, 100);//set he's health to 100
ResetPlayerWeapons(playerid);// and reset he's weapons
SetPlayerVirtualWorld(playerid, 0);//we will set he's virtual world to 0
SetPlayerInterior(playerid, 0);//also interior to 0
}
return 1;
}
}