PDA

View Full Version : I need help with scripting regarding [/accept death]


roncohen7
24/04/2016, 08:12 AM
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 !"); }

J0sh...
24/04/2016, 08:54 AM
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(playervar[i][emsvar/faction]) {
return SendClientMessage(playerid, COLOR_GREY, "There is a EMS online!");

break;
}
}

Something like that

roncohen7
24/04/2016, 09:07 AM
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(playervar[i][emsvar/faction]) {
return SendClientMessage(playerid, COLOR_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.

J0sh...
24/04/2016, 09:16 AM
You would need to put that at the start.


if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(playervar[i][emsvar/faction]) {
return SendClientMessage(playerid, COLOR_GREY, "There is a EMS online!");
break;
}
}
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 !"); }

roncohen7
24/04/2016, 09:17 AM
You would need to put that at the start.

Start of the "death" thing ?

roncohen7
24/04/2016, 09:21 AM
You would need to put that at the start.


if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
for(new i; i < MAX_PLAYERS; i++) { // GetPlayerPool() or foreach is highly recommended!
if(playervar[i][emsvar/faction]) {
return SendClientMessage(playerid, COLOR_GREY, "There is a EMS online!");
break;
}
}
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 !"); }

if(playervar[i][emsvar/faction]) { - I need to change it in if(IsAMedic(playerid))?

J0sh...
24/04/2016, 09:27 AM
IsAMedic(i)

roncohen7
27/04/2016, 08:32 AM
IsAMedic(i)

It doesn't work, I got errors.

roncohen7
27/04/2016, 08:39 AM
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?

J0sh...
27/04/2016, 02:45 PM
Would be nice if you post those errors. But;
if(strcmp(params, "death", true) == 0) {
if(GetPVarInt(playerid, "Injured") == 1) {
new cnt;
foreach(new i : 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(playerid, COLOR_GREY, "There is a EMS online!");
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 !"); }