[REQUEST] Test - 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: [REQUEST] Test (
/showthread.php?tid=206676)
[REQUEST] Test - Larsey123IsMe - 04.01.2011
I need help :P
can someone test this sctipt for me
![Smiley](images/smilies/smile.png)
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;
}
Re: [REQUEST] Test -
Toreno - 04.01.2011
Why when a player is death, Poisoned changed to 0?
That way If he got killed or died somehow, HE will be release out of jail.
Re: [REQUEST] Test -
Babul - 04.01.2011
it compiles, but the server wont work, you forgot the
also the poisoned playerS (could be any ID) needs to be in a loop (Timer Callback), to make it work for all:
Код:
public PoisonedPlayer(playerid)
{
new Float:health;
for(new ID=0;ID<MAX_PLAYERS;ID++)
{
if(Poisoned[ID] == 1)
{
GetPlayerHealth(ID, health);
SetPlayerHealth(ID, health-5);
}
}
return 1;
}
Re: [REQUEST] Test -
Babul - 04.01.2011
fuck. delete this plz ^^
Код:
for(new shame=0;shame<100;shame++)
{
SendClientMessageToAll(0xff00ffff,"i wont click 'reply' when i want to 'edit'");
}
Re: [REQUEST] Test - Larsey123IsMe - 04.01.2011
Well Thanks :P