How to add /afix and /aheal
#1

Hello, i want to add /afix (heals you're vehicle) and /aheal (heals hp 100 and armor 100) how do i have to do that?
Reply
#2

What do you use? strcmp/zcmd/ycmd/dcmd .. ?
Reply
#3

https://sampwiki.blast.hk/wiki/RepairVehicle
https://sampwiki.blast.hk/wiki/SetPlayerHealth
https://sampwiki.blast.hk/wiki/SetPlayerArmour

And I guess you need this:
https://sampwiki.blast.hk/wiki/IsPlayerAdmin
Reply
#4

Код:
if(strcmp(cmd, "/afix", true) == 0) 
{
      new vehicleid = GetPlayerVehicleID(playerid);
       if(IsPlayerInVehicle(playerid, vehicleid))
       {
       		SetVehicleHealth(vehicleid,1000.0);
            RepairVehicle(GetPlayerVehicleID(playerid));
			PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
       		GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~r~Your ~g~Vehicle ~y~Fixed!",1000,3);
	   }
else return SendClientMessage(playerid,COLOR_RED,"ERROR: you are not in any vehicle");
return 1;
}

if(strcmp(cmd, "/aheal", true) == 0) 
{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_YELLOW,"Youhave been healed/armoured");
return 1;
}
I think to Helped You!
Reply
#5

Sorry i forgot to say, only level 2+ admins are allowed to use those command, and i use strcmp.
Reply
#6

I'm newbie in coding but i dont see nothing hard there. :S

aheal

Quote:

if (strcmp("/aheal", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
return 1;
}

Quote:

if (strcmp("/afix", cmdtext, true, 10) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid, 1000.0); // 1000 is full vehicle health
SendClientMessage(playerid, COLOR_YELLOW, "Your vehicle has been successfully repaired"); // Don't forget to define color yellow at the top
return 1;
}

Reply
#7

Everyone can use this command, but i want that only admin can use those command. admin level 2+.
Reply
#8

Whats your admin level variable?
Reply
#9

What you mean what is a variable?
Reply
#10

For example:
pawn Код:
if(PlayerInfo[playerid][Adminlevel]
What you use in your script?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)