Digger.
#4

pawn Код:
new lastTPTime[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    lastTPTime[playerid] = 0;
    return 1;
}

CMD:tp(playerid, params[])
{
    if(!IsZombieDigger(playerid))return SendClientMessage(playerid, -1, "You're not the required class of Zombie to do this.");
    if(gettime() < lastTPTime[playerid])return SendClientMessage(playerid, -1, "You can't TP yet.");
   
    new id, Float:x, Float:y, Float:z;
    if(sscanf(params, "u", id))return SendClientMessage(playerid, -1, "Usage: /tp [playerid/name] - This will TP you to a human.");
    {
        if(!IsPlayerConnected(id))return SendClientMessage(playerid, -1, "That player isn't connected.");
        if(!IsHuman(id))return SendClientMessage(playerid, -1, "That player isn't a Human.");
       
        GetPlayerPos(id, x, y, z);
        SetPlayerPos(playerid, x, y-2.0, z);
       
        SendClientMessage(playerid, -1, "You have teleported to a human!");
       
        lastTPTime[playerid] = (gettime() + 120);
    }
    return 1;
}
Here's what you asked for: "i mean that if zombie using digger then teleport zombie to nearest survivour only one time and then after 2 min he can again use that perk."

It's not to the nearest player, but to a player of choice. A bit of research can get the closest player ID.
Reply


Messages In This Thread
Digger. - by Owen007 - 23.06.2016, 10:57
Re: Digger. - by Owen007 - 23.06.2016, 13:08
Re: Digger. - by Stinged - 23.06.2016, 13:23
Re: Digger. - by iGetty - 23.06.2016, 14:14
Re: Digger. - by Owen007 - 23.06.2016, 15:02

Forum Jump:


Users browsing this thread: 1 Guest(s)