dm script ??
#4

Hmm I thought you already have the commands. Well, I explained everything here (Read the comments):
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;
}
Hope you got it.
Reply


Messages In This Thread
dm script ?? - by NuLIO - 02.08.2012, 01:05
Re: dm script ?? - by [KHK]Khalid - 02.08.2012, 01:23
Re: dm script ?? - by NuLIO - 02.08.2012, 01:30
Re: dm script ?? - by [KHK]Khalid - 02.08.2012, 01:43
Re: dm script ?? - by NuLIO - 02.08.2012, 02:23
Re: dm script ?? - by [KHK]Khalid - 02.08.2012, 02:31
Re: dm script ?? - by NuLIO - 02.08.2012, 03:14
Re: dm script ?? - by [KHK]Khalid - 02.08.2012, 03:30
Re: dm script ?? - by NuLIO - 02.08.2012, 03:38
Re: dm script ?? - by [KHK]Khalid - 02.08.2012, 04:14

Forum Jump:


Users browsing this thread: 4 Guest(s)