im making a command to kill someone wen they are on the floor, (onfloor Variable) and wen i try to use this it doesnt work, i think its sumin to do with giveplayerid..... i dont get errors the command just doesnt work.. any problems people see in this code?
Code:
dcmd_floorkill(playerid,params[])
{
new string[128];
new giveplayerid;
new tmp[256];
new idx,tmpit[256];
tmpit = strtok(params,idx);
giveplayerid = strlen(tmp);
if(!strlen(tmpit))
{
SendClientMessage(playerid,COLOR_RED,"Usage: /floorkill[playerid]");
return true;
}
if(OnFloor[giveplayerid] == 1) return SendClientMessage(playerid,COLOR_RED,"That is not on the floor");
new playername[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, playername, sizeof(playername));
new onfloorname[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, onfloorname, sizeof(onfloorname));
new Float:px, Float:py, Float:pz;
GetPlayerPos(giveplayerid,px,py,pz);
if(PlayerToPoint(3.0,playerid,px,py,pz))
{
format(string, sizeof(string), "you Hover your foor above %s's head...", onfloorname);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "you see %s leg above your head...", playername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
SetTimerEx("beingkilled", 1000, 0, "i", playerid);
}
else if(!PlayerToPoint(3.0,playerid,px,py,pz))
{
SendClientMessage(playerid,COLOR_RED, "you are not close enough to kill");
}
return 1;
}