26.10.2015, 09:38
Hi, i have a small problem with my command /pc it's always returning to 0 ( Uknown command ) and idk why, i'am using some functions in this command that i will give it below and i think that the problem come from one of this functions, this is my code
Functions used
Thank's for advance.
PHP код:
CMD:pc(playerid, params[])
{
if(!IsPlayerNearCyberPost(playerid)) return Server(playerid, "You are not near computer.");
if(PosteStatus[IsPlayerNearCyberPost(playerid)] == OCCUPED) return Server(playerid, "This post is already in use.");
SetPlayerInPoste(playerid, IsPlayerNearCyberPost(playerid));
ShowPlayerBrowser(playerid);
return 1;
}
PHP код:
stock IsPlayerNearCyberPost(playerid)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1947.6533, -1815.8826, 14.0199)) return 1;// POSTE 1
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1944.6198, -1815.7053, 14.0199)) return 2; // POSTE 2
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1940.7903, -1815.7642, 14.0199)) return 3; // POSTE 3
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1940.4321, -1811.0403, 13.5583)) return 4; // POSTE 4
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1943.9427, -1807.9862, 14.0199)) return 5; // POSTE 5
}
return 0;
}
stock SetPlayerInPoste(playerid, postid)
{
switch(postid) {
case 1: SetPlayerPos(playerid, 1947.6533, -1815.8826, 14.0199); // POSTE 1
case 2: SetPlayerPos(playerid, 1944.6198, -1815.7053, 14.0199); // POSTE 2
case 3: SetPlayerPos(playerid, 1940.7903, -1815.7642, 14.0199); // POSTE 3
case 4: SetPlayerPos(playerid, 1940.4321, -1811.0403, 13.5583); // POSTE 4
case 5: SetPlayerPos(playerid, 1943.9427, -1807.9862, 14.0199); // POSTE 5
}
pInfo[playerid][pUsingPost] = postid;
PosteStatus[postid] = OCCUPED;
Freeze(playerid);
ApplyAnimation(playerid,"FOOD","FF_Sit_In",4.1,0,1,1,1,1);
return 1;
}
ShowPlayerBrowser(playerid)
{
for(new i; i < 8; ++i)
{
TextDrawShowForPlayer(playerid, TD_Cyber[i]);
PlayerTextDrawSetString(playerid, PTD_Cyber[playerid][0], ******_URL);
PlayerTextDrawShow(playerid, PTD_Cyber[playerid][0]);
}
return 1;
}