Can you help me with this? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can you help me with this? (
/showthread.php?tid=255605)
Can you help me with this? -
Cjgogo - 16.05.2011
OK,so now it was much more eaiser to script this command,than trying to script it with strcmp and strtok wich gave me bad head aches(I converted to ZCMD):
And now this is my new heal command,but I have some errors:
pawn Код:
COMMAND:heal(playerid,params[])
{
if(gTeam[playerid] == TEAM_MEDICS)
{
new p1;
new p2;
if(sscanf(params,"u",p2) return SendClientMessage(playerid,COLOR_RED,"USAGE: /heal [id]");
GetPlayerHealth(p2); //line 696
if(GetPlayerHealth(p2) < 80) //line 697
{
GetDistanceBetweenPlayers(p1,p2);
if(GetDistanceBetweenPlayers(p1,p2) > 5) return SendClientMessage(p1,COLOR_RED,"Player is too far away");
if(GetDistanceBetweenPlayers(p1,p2) < 5)
{
SetPlayerHealth(p2,100);
GivePlayerMoney(p2,-500);
GivePlayerMoney(p1,500);
SendClientMessageToAll(COLOR_PURPLE,"Player %s has been healed by medic %s");
}
}
}
if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_ROBBERS || gTeam[playerid] == TEAM_FIREFIGHTERS)
{
SendClientMessage(playerid,COLOR_RED,"This command is only for medics.");
return 0;
}
return true;
}
My errors are:
Код:
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_R2-2_win32\gamemodes\sfcrdmrp.pwn(696) : warning 202: number of arguments does not match definition
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_R2-2_win32\gamemodes\sfcrdmrp.pwn(697) : warning 202: number of arguments does not match definition
WARNING:I'm not sure if it is gonna work in-game so please don't try just to fix errors but also tell me if this could work in game or no(I mean if it's scripted corectly or no)
Respuesta: Can you help me with this? -
K9- - 16.05.2011
pawn Код:
COMMAND:heal(playerid,params[])
{
if(gTeam[playerid] == TEAM_MEDICS)
{
new p1;
new p2;
new Float:Health;
if(sscanf(params,"u",p2) return SendClientMessage(playerid,COLOR_RED,"USAGE: /heal [id]");
GetPlayerHealth(p2, Health); //line 696
if(GetPlayerHealth(p2) < 80) //line 697
{
GetDistanceBetweenPlayers(p1,p2);
if(GetDistanceBetweenPlayers(p1,p2) > 5) return SendClientMessage(p1,COLOR_RED,"Player is too far away");
if(GetDistanceBetweenPlayers(p1,p2) < 5)
{
SetPlayerHealth(p2,100);
GivePlayerMoney(p2,-500);
GivePlayerMoney(p1,500);
SendClientMessageToAll(COLOR_PURPLE,"Player %s has been healed by medic %s");//create a string
}
}
}
if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_ROBBERS || gTeam[playerid] == TEAM_FIREFIGHTERS)
{
SendClientMessage(playerid,COLOR_RED,"This command is only for medics.");
return 0;
}
return true;
}
Re: Can you help me with this? -
Cjgogo - 16.05.2011
VERY FUNNY YOU POSTED THE SAME THING AS I DID(if you don't know scripting yet as you're a little clucker don't try to help others yet)
Re: Can you help me with this? -
Seven_of_Nine - 16.05.2011
What the f*ck is that?
pawn Код:
GetPlayerHealth(playerid, &Float:health)
Then, it should be:
pawn Код:
GetPlayerHealth(p2,Health);
if(Health < 80)