PDA

View Full Version : script


viosteaua98
11/11/2011, 03:45 PM
i need a script of dm
teleport command i want
special i want max 2 player there if someone try to go there will die

viosteaua98
11/11/2011, 03:51 PM
man
i want place where just 2 people can go if 3rd people try to go will die

Kostas'
11/11/2011, 03:55 PM
Try to make it yourself, it's good for your experience.
If else Script Request Thread (http://forum.sa-mp.com/showthread.php?t=187229&page=157)

Mean
11/11/2011, 06:21 PM
// Put this anywhere in your script, just not in a callback. These are public variables.
new
g_dmplayers = 0
,g_playerindm[ MAX_PLAYERS ]
;

//OnPlayerCommandText
public OnPlayerCommandText( playerid, cmdtext[ ] ) {
if( !strcmp( cmdtext, "/dm", true ) ) {
if( g_dmplayers > 1 )
return SendClientMessage( playerid, -1, "There are 2 players in DM. Wait for somebody to leave. " );
SetPlayerPos( playerid, Float:DM_X, Float:DM_Y, Float:DM_Z ); // Replace the X, Y and Z position.
g_dmplayers ++;
g_playerindm[ playerid ] = 1;
}
if( !strcmp( cmdtext, "/leave", true ) ) {
if( g_playerindm[ playerid ] == 0 )
return SendClientMessage( playerid, -1, "You are not in DM. " );
g_dmplayers --;
g_playerindm[ playerid ] = 0;
SpawnPlayer( playerid );
}
return 0;
}

// OnPlayerSpawn
public OnPlayerSpawn( playerid ) {
if( g_playerindm[ playerid ] == 1 )
SetPlayerPos( playerid, Float:DM_X, Float:DM_Y, Float:DM_Z ); // Replace the X, Y and Z position.
return 1;
}

//OnPlayerDisconnect
public OnPlayerDisconnect( playerid, reason ) {
if( g_playerindm[ playerid ] == 1 ) {
g_dmplayers --;
g_playerindm[ playerid ] = 0;
}
return 1;
}
Untested, but should be working.