I need help with scripting regarding [/accept death]
#1

Hey everyone,
I want to delete [/accept death] but I don't want to delete it completely only to enable/disable it, let me explain.
I got RP server and I want FD have work and not get bored, I want to script /accept death to be disabled when FD members are on and when the are no members /accept death will be enabled to use..
That is possible to script thing like that?
Please help me.

Code:
Код:
if(strcmp(params, "death", true) == 0) {
            if(GetPVarInt(playerid, "Injured") == 1) {
                SendClientMessageEx(playerid, COLOR_WHITE, "You gave up hope and fell unconscious, you were immediately sent to the hospital.");
                KillEMSQueue(playerid);
                ResetPlayerWeaponsEx(playerid);
                SpawnPlayer(playerid);
            }
            else {  SendClientMessageEx(playerid, COLOR_GREY, "   You are not injured, you can't do this right now !"); }
Reply
#2

PHP код:
for(new iMAX_PLAYERSi++) { // GetPlayerPool() or foreach is highly recommended!
    
if(playervar[i][emsvar/faction]) {
        return 
SendClientMessage(playeridCOLOR_GREY"There is a EMS online!");
        
        break;
    }

Something like that
Reply
#3

Quote:
Originally Posted by Jamester
Посмотреть сообщение
PHP код:
for(new iMAX_PLAYERSi++) { // GetPlayerPool() or foreach is highly recommended!
    
if(playervar[i][emsvar/faction]) {
        return 
SendClientMessage(playeridCOLOR_GREY"There is a EMS online!");
        
        break;
    }

Something like that
Where exactly I need to put your code at? Show me full code with my code too please.
Reply
#4

You would need to put that at the start.

PHP код:
if(strcmp(params"death"true) == 0) {
            if(
GetPVarInt(playerid"Injured") == 1) {
                for(new 
iMAX_PLAYERSi++) { // GetPlayerPool() or foreach is highly recommended!
                    
if(playervar[i][emsvar/faction]) {
                        return 
SendClientMessage(playeridCOLOR_GREY"There is a EMS online!");
                           break;
                       }
                }  
                   
SendClientMessageEx(playeridCOLOR_WHITE"You gave up hope and fell unconscious, you were immediately sent to the hospital.");
                   
KillEMSQueue(playerid);
                    
ResetPlayerWeaponsEx(playerid);
                    
SpawnPlayer(playerid);
            }
            else {  
SendClientMessageEx(playeridCOLOR_GREY"   You are not injured, you can't do this right now !"); } 
Reply
#5

Quote:
Originally Posted by Jamester
Посмотреть сообщение
You would need to put that at the start.
Start of the "death" thing ?
Reply
#6

Quote:
Originally Posted by Jamester
Посмотреть сообщение
You would need to put that at the start.

PHP код:
if(strcmp(params"death"true) == 0) {
            if(
GetPVarInt(playerid"Injured") == 1) {
                for(new 
iMAX_PLAYERSi++) { // GetPlayerPool() or foreach is highly recommended!
                    
if(playervar[i][emsvar/faction]) {
                        return 
SendClientMessage(playeridCOLOR_GREY"There is a EMS online!");
                           break;
                       }
                }  
                   
SendClientMessageEx(playeridCOLOR_WHITE"You gave up hope and fell unconscious, you were immediately sent to the hospital.");
                   
KillEMSQueue(playerid);
                    
ResetPlayerWeaponsEx(playerid);
                    
SpawnPlayer(playerid);
            }
            else {  
SendClientMessageEx(playeridCOLOR_GREY"   You are not injured, you can't do this right now !"); } 
if(playervar[i][emsvar/faction]) { - I need to change it in if(IsAMedic(playerid))?
Reply
#7

IsAMedic(i)
Reply
#8

Quote:
Originally Posted by Jamester
Посмотреть сообщение
IsAMedic(i)
It doesn't work, I got errors.
Reply
#9

Код:
new OnDutyMedics;
		foreach(new i: Player)
		{
			if(IsAMedic(i) && PlayerInfo[i][pDuty] == 1)
			{
				OnDutyMedics++;
			}
		}
		if(OnDutyMedics < 1)
		{
I found this code in a command of [/service medic]
Will it help you to make the code now?
Reply
#10

Would be nice if you post those errors. But;
PHP код:
if(strcmp(params"death"true) == 0) {
            if(
GetPVarInt(playerid"Injured") == 1) {
                new 
cnt;
                foreach(new 
Player) { // GetPlayerPool() or foreach is highly recommended!
                    
if(IsAMedic(i) && PlayerInfo[i][pDuty] == 1) {
                        
cnt++;
                    }
                    else if(!
IsAMedic(i)) continue;
                }  
                if(
cnt != 0
                   return 
SendClientMessage(playeridCOLOR_GREY"There is a EMS online!"); 
                   
SendClientMessageEx(playeridCOLOR_WHITE"You gave up hope and fell unconscious, you were immediately sent to the hospital.");
                   
KillEMSQueue(playerid);
                    
ResetPlayerWeaponsEx(playerid);
                    
SpawnPlayer(playerid);
            }
            else {  
SendClientMessageEx(playeridCOLOR_GREY"   You are not injured, you can't do this right now !"); } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)