Can you help me with this?
#1

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)
Reply
#2

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;
}
Reply
#3

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)
Reply
#4

What the f*ck is that?
pawn Код:
GetPlayerHealth(playerid, &Float:health)
Then, it should be:
pawn Код:
GetPlayerHealth(p2,Health);
if(Health < 80)
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)