27.07.2012, 01:19
Im making a defuse system but the problem is, that looks like the script doesnt check if the player is near object
My code
My code
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new Float:x, Float:y, Float:z; new Float:q, Float:w, Float:e; new deton; GetObjectPos(deton, q,w,e); if (strcmp("/detonate", cmdtext, true, 10) == 0) { GetPlayerPos(playerid, x,y,z); deton = CreateObject(1252,x,y,z,0,0,0); GameTextForPlayer(playerid, "Bomb planted!",2000,3); return 1; } if (strcmp("/defuse", cmdtext, true, 10) == 0) { if(IsPlayerInRangeOfPoint(playerid, 10.5,q,w,e)) { TextDrawShowForPlayer(playerid,Textdraw0[playerid]); TextDrawShowForPlayer(playerid,Textdraw1[playerid]); TextDrawShowForPlayer(playerid,Textdraw2[playerid]); GameTextForPlayer(playerid, "Defusing bomb!",2000,3); taim = SetTimer("defuse",50,true); playerid = defid; } else { GameTextForPlayer(playerid, "You need to be near the bomb!",2000,3); } return 1; } return 0; }