31.07.2012, 20:12
try this
and wherever you want add this except callbacks
try this is good
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], index;
cmd = strtok(cmdtext,index);
if (strcmp("/vbite", cmd, true, 10) == 0)
{
new tmp[256];
if(!strlen(tmp) ) return SendClientMessage(playerid,-1,"[USAGE] /vbite [id]");
new Float:x, Float:y, Float:z;
new targetid;
targetid = strval(tmp);
GetPlayerPos(targetid,x,y,z);
if(IsPlayerInRangeOfPoint(playerid,2.0,x,y,z))return SendClientMessage(playerid,0xE00404,"You are not near the player");
{
SetPlayerHealth(targetid,10);
SendClientMessage(targetid,0xE00404,"You have been bitten by a vampire");
SetPlayerDrunkLevel(playerid,3000);
ApplyAnimation(playerid,"KISSING","Grlfrd_Kiss_01",4.1,0,0,0,0,1,1);
}
return 1;
}
return 0;
}
pawn Код:
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;
}
