15.02.2017, 13:23
Code:
Alright so..
it will loop through all the druglabs and then check if the player is close to the /exit point, thats how I check if the player is inside, then it will check if the player is the owner by checking if OwnerID si the same as ID from the player, unique database ID, and if they both match nothing is happening, this code is not executing:
PHP код:
else if(!strcmp(param, "hire"))
{
new Float:x, Float:y, Float:z, Float:prot;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, prot);
for(new i; i < MAX_DLABS; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 300.0, DrugLabs[i][ExitX], DrugLabs[i][ExitY], DrugLabs[i][ExitZ]))
{
if(DrugLabs[i][OwnerID] == PlayerInfo[playerid][ID])
{
new DB_Query[150];
LabCooker[i] = CreateActor(70, x, y, z, prot);
ApplyActorAnimation(LabCooker[i], "BD_FIRE", "wash_up", 4.1, 1, 0, 0, 0, 0);
SetActorVirtualWorld(LabCooker[i], DrugLabs[i][VirtualWorld]);
mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `DrugLabs` SET `ActorSkin` = 70, `ActorPosX` = %f, `ActorPosY` = %f, `ActorPosZ` = %f, `ActorRot` = %f WHERE `ID` = %d"
, x, y, z, prot, DrugLabs[i][ID]);
mysql_tquery(Database, DB_Query);
SendClientMessage(playerid, COLOR_WHITE, "Hired!");
break;
}
else
{
if(PlayerInfo[playerid][pLanguage] == 1)
{
SCM(playerid, COLOR_GREY, "You don't own this place.");
break;
}
else
{
SCM(playerid, COLOR_GREY, "Nu ai cheie.");
break;
}
}
}
else
{
if(PlayerInfo[playerid][pLanguage] == 1)
{
SCM(playerid, COLOR_GREY, "You are not inside a druglab.");
break;
}
else
{
SCM(playerid, COLOR_GREY, "Nu esti intr-un druglab.");
break;
}
}
}
}
it will loop through all the druglabs and then check if the player is close to the /exit point, thats how I check if the player is inside, then it will check if the player is the owner by checking if OwnerID si the same as ID from the player, unique database ID, and if they both match nothing is happening, this code is not executing:
PHP код:
if(DrugLabs[i][OwnerID] == PlayerInfo[playerid][ID])
{
new DB_Query[150];
LabCooker[i] = CreateActor(70, x, y, z, prot);
ApplyActorAnimation(LabCooker[i], "BD_FIRE", "wash_up", 4.1, 1, 0, 0, 0, 0);
SetActorVirtualWorld(LabCooker[i], DrugLabs[i][VirtualWorld]);
mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `DrugLabs` SET `ActorSkin` = 70, `ActorPosX` = %f, `ActorPosY` = %f, `ActorPosZ` = %f, `ActorRot` = %f WHERE `ID` = %d"
, x, y, z, prot, DrugLabs[i][ID]);
mysql_tquery(Database, DB_Query);
SendClientMessage(playerid, COLOR_WHITE, "Hired!");
break;
}