28.10.2017, 00:12
Hey,
I just want to make a Arrest Command for Cops so they can arrest players per key for example "Crouch"
this players must be in near. Idk exactly how to handle pid & playerid on this. If I try to arrest people in my near
its always saying "not in range"
Can you help me?
My arrest stock:
Thats my normal arrest command: (working fine)
I just want to make a Arrest Command for Cops so they can arrest players per key for example "Crouch"
this players must be in near. Idk exactly how to handle pid & playerid on this. If I try to arrest people in my near
its always saying "not in range"
Can you help me?
Quote:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { new pid; if(IsPlayerCop(playerid)) if(newkeys == KEY_CROUCH) { new Float: x, Float:y, Float:z; GetPlayerPos(pid, x,y,z); if(IsPlayerInRangeOfPoint(playerid, 2, x, y, z)) { Arrest(pid); return 1; } } else { SendClientMessage(playerid,COLOR_RED,"Not in range!"); } else { SendClientMessage(playerid,COLOR_RED,"Not a Cop!"); } return 1; } |
My arrest stock:
Quote:
stock Arrest(playerid) { SetPlayerInterior(playerid,6); SetPlayerPos(playerid,264.5287,77.6026,1001.0391); return 1; } |
Thats my normal arrest command: (working fine)
Quote:
ocmd:arrest(playerid,params[]) { new pid; if(sscanf(params,"u", pid)) { return SendClientMessage(playerid,BLAU,"*USAGE:{f0e68c}/arrest [ID]"); } if(!IstSpielerInFraktion(playerid, 1)) return SendClientMessage(playerid,BLAU,"NOT IN LSPD!"); { if(pid == INVALID_PLAYER_ID) { return SendClientMessage(playerid,ROT,"[Server]: Player is not connected"); } if(loggedin[playerid] == 0) { SendClientMessage(playerid,COLOR_RED,"Not logged in!"); } { new Float: x, Float:y, Float:z; GetPlayerPos(pid, x,y,z); if(IsPlayerInRangeOfPoint(playerid, 2, x, y, z)) { SetPlayerInterior(pid,6); SetPlayerPos(pid,264.5287,77.6026,1001.0391); new string[128]; new cuff[128]; format(string, sizeof(string), "Officer %s arrested you ", GetName(playerid)); SendClientMessage(pid, BLAU,string); GameTextForPlayer(pid, "Cuffed", 5000, 6); format(cuff, sizeof(cuff), "You arrested %s ", GetName(pid)); SendClientMessage(playerid, BLAU, cuff); return 1; } } { SendClientMessage(playerid,BLAU,"Not in range of this Player!"); return 1; } } } |