How to add /afix and /aheal - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to add /afix and /aheal (
/showthread.php?tid=279928)
How to add /afix and /aheal -
maikel saliba - 29.08.2011
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?
Re: How to add /afix and /aheal -
Jafet_Macario - 29.08.2011
What do you use? strcmp/zcmd/ycmd/dcmd .. ?
Re: How to add /afix and /aheal -
=WoR=Varth - 29.08.2011
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
Re: How to add /afix and /aheal -
HotPlayer - 29.08.2011
Код:
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!
Re: How to add /afix and /aheal -
maikel saliba - 29.08.2011
Sorry i forgot to say, only level 2+ admins are allowed to use those command, and i use strcmp.
Re: How to add /afix and /aheal -
Kobatz - 29.08.2011
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;
}
|
Re: How to add /afix and /aheal -
maikel saliba - 29.08.2011
Everyone can use this command, but i want that only admin can use those command. admin level 2+.
Re: How to add /afix and /aheal -
[MG]Dimi - 29.08.2011
Whats your admin level variable?
Re: How to add /afix and /aheal -
maikel saliba - 29.08.2011
What you mean what is a variable?
Re: How to add /afix and /aheal -
Kingunit - 29.08.2011
For example:
pawn Код:
if(PlayerInfo[playerid][Adminlevel]
What you use in your script?