[HELP]/leave Command to disable everything
#1

Hello all , i have a /minigundm cmd , /kart1 cmd , and /dm cmd ..
So , i want something that will make player Send MSG if he is in /minigundm and if he types , /dm , he must get a msg /leave to join !

MinigunDM codes
Quote:

CMD:minigundm(playerid, params[])
{

new Random = random(sizeof(RandomSpawns));
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
GivePlayerWeapon(playerid,38 ,10000);
return 1;
}

And he can't type any other cmd ..
Reply
#2

You must work with an Array, e.g:

PHP Code:
new bool:inMinigun[MAX_PLAYERS char];
//In this CMD:minigundm
inMinigun{playerid} = true;
//In the other commands:
if(inMinigun{playerid}) return SCM(playerid,-1,"You are in a Minigun DM! Make /leave to leave it!");
//In the leave command:
if(!inMinigun{playerid}) return SCM(playerid,-1,"You aren't in a Minigun Event!");
inMinigun{playerid} = false
I hope you understand what i mean
Reply
#3

SCM means Send Client Message?

Can you give me the /leave cmd codes? zcmd?
Reply
#4

Quote:
Originally Posted by fuckingcruse
View Post
SCM means Send Client Message?
Yes

You can do in top of your script a little Makro for this:

Code:
#define SCM SendClientMessage
Then you can use it
Reply
#5

Erm? Can you give me the /leave cmd codes according to my script? zcmd
Reply
#6

Quote:
Originally Posted by fuckingcruse
View Post
Erm? Can you give me the /leave cmd codes according to my script? zcmd
Erm...are you serious right now

Read tutorials if you don't know how to make it..but it's that easy...well:

PHP Code:
CMD:leave(playerid)
{
    
//In the leave command: 
    
if(!inMinigun{playerid}) return SCM(playerid,-1,"You aren't in a Minigun Event!"); 
    
inMinigun{playerid} = false;  
    return 
1;

...Greekz
Reply
#7

See this ,
Quote:

new bool:inMinigun[MAX_PLAYERS char];
new Float:RandomSpawns[][] =
{
{3218.5200,-5201.4214,19.9078,262.0082},
{3227.8022,-5166.6245,24.2328,96.1082}, // Randomspawn
{3175.1887,-5153.1538,19.9078,98.8068}, // Randomspawn
{3120.7822,-5154.1133,20.0940,273.9126},
{3096.3271,-5249.3701,19.9078,271.0925},
{3182.8801,-5266.5200,19.9078,199.3386},
{3170.6882,-5214.8340,21.7125,94.0811},
{3196.1052,-5163.3623,19.9078,265.6208},
{3227.5005,-5140.2788,27.3782,270.0076},
{3111.1736,-5198.4761,22.2381,183.0685},
{3114.3625,-5227.9263,20.0844,240.3857},
{3130.5708,-5266.6069,23.7437,359.0188},
{3228.0046,-5244.7256,24.2328,99.6953}
};



CMD:minigundm(playerid, params[])
{
inMinigun{playerid} = true;
new Random = random(sizeof(RandomSpawns));
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
GivePlayerWeapon(playerid,38 ,10000);
return 1;
}
CMD:leave(playerid)
{
//In the leave command:
if(!inMinigun{playerid}) return SendClientMessage(playerid,-1,"You aren't in a Minigun Event!");
inMinigun{playerid} = false;
return 1;
}
CMD:kart1(playerid, params[])
{
SetPlayerPos(playerid , -1187.89453125,-1032.46899414,128.55102539);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid , 100000);
SendClientMessage(playerid ,0x00FF00FF , " Welcome to Kart FreeRoam");
SetPlayerArmour(playerid , 0);
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");

return 1;
}

CMD:dm(playerid, params[])
{
SetPlayerPos(playerid , -1386.0922, 3986.8069, 98.6692);
SendClientMessage(playerid, 0x00FF00FF, "Welcome TO Deagle and Shotgun DM .");
SetPlayerHealth(playerid, 100);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 25, 100000);
GivePlayerWeapon(playerid, 24, 100000);
SetPlayerArmour(playerid, 100);
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Make /leave to leave it!");
return 1;
}


CMD:kill(playerid,params[])
{
SetPlayerHealth(playerid, 0);
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Make /leave to leave it!");
return 1;
}

And when the player types /dm , he spawns in DM and when he types /minigundm he spawns in minigundm , at randomspawns everytime , i want something like when he type /minigundm when he is in the minigundm , he must not spawn again at randomspawn and , he must not spawn in any other tele
Reply
#8

You must write the if-clause at the top:

PHP Code:
CMD:minigundm(playeridparams[])
{
if(
inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are already in a Minigun DM!");
inMinigun{playerid} = true;
new 
Random random(sizeof(RandomSpawns));
SetPlayerHealth(playerid100);
SetPlayerArmour(playerid100);
SetPlayerPos(playeridRandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playeridRandomSpawns[Random][3]);
GivePlayerWeapon(playerid,38 ,10000);
return 
1;
}
CMD:leave(playerid)
{
//In the leave command:
if(!inMinigun{playerid}) return SendClientMessage(playerid,-1,"You aren't in a Minigun Event!");
inMinigun{playerid} = false;
return 
1;
}
CMD:kart1(playeridparams[])
{
if(
inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");
SetPlayerPos(playerid , -1187.89453125,-1032.46899414,128.55102539);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid 100000);
SendClientMessage(playerid ,0x00FF00FF " Welcome to Kart FreeRoam");
SetPlayerArmour(playerid 0);
return 
1;
}
CMD:dm(playeridparams[])
{
if(
inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");
SetPlayerPos(playerid , -1386.09223986.806998.6692);
SendClientMessage(playerid0x00FF00FF"Welcome TO Deagle and Shotgun DM .");
SetPlayerHealth(playerid100);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid25100000);
GivePlayerWeapon(playerid24100000);
SetPlayerArmour(playerid100);
return 
1;
}
CMD:kill(playerid,params[])
{
if(
inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");
SetPlayerHealth(playerid0);
return 
1;

Greekz
Reply
#9

Still the same , when player type /minigundm , he respawns more times , like if i typed /minigundm , i spawn at minigundm and if again i type /minigundm i spawn again , it doesn't show anything that you are already in minigun dm.. and if i am in minigundm , and i type /dm or /kart1 , he spawns there...

Codes
Quote:

CMD:minigundm(playerid, params[])
{
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are already in a Minigun DM!");
new Random = random(sizeof(RandomSpawns));
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
GivePlayerWeapon(playerid,38 ,10000);
return 1;
}
CMD:leave(playerid)
{
//In the leave command:
if(!inMinigun{playerid}) return SendClientMessage(playerid,-1,"You aren't in a Minigun Event!");
inMinigun{playerid} = false;
return 1;
}

CMD:weapons(playerid,params[])
{
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle - 150 Ammo [ Cost - $500 ]\nChainSaw - 1 [ Cost - $500 ]\nSilenced 9mm - 150 Ammo [ Cost - $500]\nShotGun - 150 Ammo [ Cost - $700]\nSawnoff Shotgun - 200 Ammo [ Cost - $1k ]\nCombactShotgun - 200 Ammo [ Cost $1k ]\nMicro Guns - SMG[ Cost - $800 ]\nMicro Guns - UZI [ Cost - $800 ]\nM4 - [ Cost - $1500 ]\nAK47 [ Cost - $1500 ]\nCountyRifle [ Cost - $2000 ]\nSniperRifle [ Cost - $2000]", "Select", "Close");
return 1;
}



CMD:kart1(playerid, params[])
{
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");
SetPlayerPos(playerid , -1187.89453125,-1032.46899414,128.55102539);
ResetPlayerWeapons(playerid);
SetPlayerHealth(playerid , 100000);
SendClientMessage(playerid ,0x00FF00FF , " Welcome to Kart FreeRoam");
SetPlayerArmour(playerid , 0);


return 1;
}

CMD:dm(playerid, params[])
{
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");
SetPlayerPos(playerid , -1386.0922, 3986.8069, 98.6692);
SendClientMessage(playerid, 0x00FF00FF, "Welcome TO Deagle and Shotgun DM .");
SetPlayerHealth(playerid, 100);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 25, 100000);
GivePlayerWeapon(playerid, 24, 100000);
SetPlayerArmour(playerid, 100);

return 1;
}


CMD:kill(playerid,params[])
{
if(inMinigun{playerid}) return SendClientMessage(playerid,-1,"You are in a Minigun DM! Type /leave to leave it!");
SetPlayerHealth(playerid, 0);

return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)