SA-MP Forums Archive
help please - 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: help please (/showthread.php?tid=146986)



help please - kujox32 - 09.05.2010

pawn Код:
if(strcmp(cmd, "/bite", true) ==0)
    {
        if(team[playerid] != 2)
        {
        SendClientMessage(playerid, COLOR_YELLOW, "You dont want to bite people, you are Human.");
            return 1;
        }
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /bite [playerid]");
            return 1;
        }
        if(!IsNumeric(tmp)) target = ReturnPlayerID(tmp); else target = strval(tmp);
        if(GetDistanceBetweenPlayers(playerid,target) > 2)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "Target is to far away.");
            return 1;
        }
        GetPlayerName(target, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(team[playerid] == 2)
        {
        new Float:hp;
          if(team[target] == 1 || team[target] <= 2) return SendClientMessage(playerid,COLOR_RED,"That player is not a human.");
            format(string, sizeof(string), "You were infected by %s.", sendername);
            SendClientMessage(target, COLOR_RED, string);
            format(string, sizeof(string), "You infected %s.", giveplayer);
            SendClientMessage(playerid, COLOR_GREEN, string);
            GameTextForPlayer(target, "Infected!", 2500, 3);
            SendClientMessage(target, COLOR_RED, "You have been infected! Get to the hospital for the antidote! ");
            SendClientMessage(target, COLOR_YELLOW, "Reach the red checkpoint before you die and become a zombie. ");
            SetPlayerCheckpoint(target, 1606.983154, 1822.565551, 10.820312, 8.0);
            infected[target] = 1;
            GetPlayerHealth(target,hp);
            SetPlayerHealth(playerid, 100);
            GameTextForPlayer(target, "~r~YOU ARE INFECTED!!!", 2500, 3);
            GameTextForPlayer(playerid, "~g~BITE (HEAL)!", 2500, 3);
        }
        return 1;
    }
every time we type /bite [playerid] it just pulls up the usage all the time help please?


Re: help please - Backwardsman97 - 10.05.2010

Obviously the problem is where you defined tmp, not in the command.


Re: help please - MrEnd - 10.05.2010

haha lol i cant help but what GM do you have? :P and why do you want to bite? XD


Re: help please - kujox32 - 10.05.2010

Quote:
Originally Posted by Baked-Banana
Obviously the problem is where you defined tmp, not in the command.
well where should I put it?


Re: help please - Grim_ - 10.05.2010

Assuming you're using strtok..
pawn Код:
tmp = strtok(cmdtext, idx);
Put that right before:
pawn Код:
if(!strlen(tmp))



Re: help please - kujox32 - 10.05.2010

Quote:
Originally Posted by Grim_
Assuming you're using strtok..
pawn Код:
tmp = strtok(cmdtext, idx);
Put that right before:
pawn Код:
if(!strlen(tmp))
It works thanks you sexy beast xD


Re: help please - Grim_ - 10.05.2010

No problem.