02.08.2012, 01:43
(
Последний раз редактировалось [KHK]Khalid; 02.08.2012 в 02:31.
)
Hmm I thought you already have the commands. Well, I explained everything here (Read the comments):
Hope you got it.
pawn Код:
// top of script
new Dming[MAX_PLAYERS];
// We gonna set the value of this variable to 1 when a player joins a dm, and to 0 when a player leaves a dm.
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/dm", true))
{
// As I said above we will set it to 1 while in dm
Dming[playerid] = 1;
// After that you can add your other codes, teleports, weapons and stuff
return 1;
}
if(!strcmp(cmdtext, "/leavedm", true))
{
Dming[playerid] = 0; // tells the script that the player is out of any dm
SpawnPlayer(playerid); // spawn
return 1;
}
return 0;
}
// now for the OnPlayerSpawn part. This callback is called when a player spawns
public OnPlayerSpawn(playerid)
{
if(Dming[playerid] == 1) // if was in a dm (This won't work if you set Dming to 0 under OnPlayerDeath)
{
// Respawn
// Simply add the codes that you added in /dm
}
return 1;
}
public OnPlayerConnect(playerid)
{
Dming[playerid] = 0; // when a player connects set it to 0 (To avoid ids conflicts)
return 1;
}