public OnPlayerCommandText(playerid,params[])
{
if(strcmp(cmdtext,"/dm",true) == 0)
{
SetPlayerPos(playerid,0.0,0.0,0.0);
SetPVarInt(playerid,"in_DM",1); // Store the fact that he is in the deathmatch
return 1;
}
if(strcmp(cmdtext,"/sf",true) == 0)
{
SetPlayerPos(playerid,0.0,0.0,0.0); // Take him away from DM
ResetPlayerWeapons(playerid); // Take away his guns
SetPVarInt(playerid,"in_DM",0); // Reset his PVariable
return 1;
}
return 0;
}
public OnPlayerDeath(playerid)
{
if(GetPVarInt(playerid,"in_DM")) // So he's still in the deathmatch
{
SetPlayerPos(playerid,0.0,0.0,0.0); // Put him back there
}
return 1;
}
|
You need to setup a way to check if the player is in the deathmatch or not OnPlayerDeath.
Example: pawn Код:
|
|
Sorry, OnPlayerDeath wouldn't work with this. Use OnPlayerSpawn instead of OnPlayerDeath for that check.
|
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
TextDrawHideForPlayer(playerid, Welcome);
TextDrawHideForPlayer(playerid, TheBoxy);
TextDrawHideForPlayer(playerid, Weilcome);
TextDrawHideForPlayer(playerid, thelp);
TextDrawHideForPlayer(playerid, ttele);
TextDrawHideForPlayer(playerid, trules);
TextDrawShowForPlayer(playerid, MoveCmd);
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw2);
TextDrawShowForPlayer(playerid, Textdraw4);
TextDrawShowForPlayer(playerid, Textdraw5);
TextDrawShowForPlayer(playerid, Textdraw6);
SetPlayerArmour(playerid,100);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,33,20);
GivePlayerWeapon(playerid,4,1);
GivePlayerWeapon(playerid,23,250);
GivePlayerWeapon(playerid,28,200);
GivePlayerWeapon(playerid,46,1);
GivePlayerWeapon(playerid,41,100);
GivePlayerMoney(playerid,15000);
if(GetPVarInt(playerid,"in_DM")) // So he's still in the deathmatch
{
new rand = random(sizeof(MDM));
SetPlayerPos(playerid,MDM[rand][PlayerX],MDM[rand][PlayerY],MDM[rand][PlayerZ]);
SetPlayerInterior(playerid,10);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,38,9999999);
// Put him back there
}
new rand = random(4);
switch (rand) {
case 0:SetPlayerPos(playerid,405.9053,2456.6348,16.5000),SendClientMessage(playerid,COLOR_WHITE,"Spawn Info:You have been spawned at /aa!");
case 1:SetPlayerPos(playerid,1318.2029,1284.1371,10.8203),SendClientMessage(playerid,COLOR_WHITE,"Spawn Info:You have been spawned at /lvair!");
case 2:SetPlayerPos(playerid,1978.5294,-2617.4849,19.0112),SendClientMessage(playerid,COLOR_WHITE,"Spawn Info:You have been spawned at /lsair!");
case 3:SetPlayerPos(playerid,-1454.7158,-162.1252,14.1484),SendClientMessage(playerid,COLOR_WHITE,"Spawn Info:You have been spawned at /sfair!");
}
return 1;
}
|
If you don't want it to remove the player weapons don't add the ResetPlayerWeapons(playerid); function
|