[REQUEST] Test
#1

I need help :P

can someone test this sctipt for me im not sure if it works:

PS. I cant test this script on myself >.<

pawn Код:
#include <a_samp>

forward PoisonedPlayer(playerid);
new Poisoned[MAX_PLAYERS];

public OnFilterScriptInit()
{
    SetTimer("PoisonedPlayer",30000,true);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    Poisoned[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], idx, tmp[256];
    cmd = strtok(cmdtext, idx);

    new targetid = strval(tmp);
    tmp = strtok(cmdtext, idx);

    new pName [MAX_PLAYER_NAME], tName [MAX_PLAYER_NAME], string [128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    GetPlayerName(targetid, tName, MAX_PLAYER_NAME);
   
   
    if (strcmp("/apoison", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF303EAA,"Your not an admin!");
        if(!strlen(tmp)) return SendClientMessage(playerid,0xFF303EAA,"UASGE: /apoison [ID]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF303EAA,"Player is not connected");

        format (string, sizeof(string), "Admin %s(%d) has poisoned %s(%d)", pName, playerid, tName, targetid);
        SendClientMessageToAll(0xA9A9A9FF, string);

        Poisoned[targetid] = 1;
        return 1;
    }
    return 0;
}

public PoisonedPlayer(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid, health);

    if(Poisoned[playerid] == 1)
    {
        SetPlayerHealth(playerid, health-5);
    }
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread
[REQUEST] Test - by Larsey123IsMe - 04.01.2011, 12:19
Re: [REQUEST] Test - by Toreno - 04.01.2011, 12:56
Re: [REQUEST] Test - by Babul - 04.01.2011, 13:50
Re: [REQUEST] Test - by Babul - 04.01.2011, 13:52
Re: [REQUEST] Test - by Larsey123IsMe - 04.01.2011, 14:30

Forum Jump:


Users browsing this thread: 2 Guest(s)