#define MAX_WORKPLACES 3
enum
{
DIALOG_WORKPLACES
};
CMD:trabalhar(playerid)
{
new Float:x, Float:y, Float:z, place[20];
GetCloseWorkPlace(playerid,x,y,z,place);
ShowPlayerDialog(playerid,DIALOG_WORKPLACES,DIALOG_STYLE_INPUT,"Trabalho prуximo",place,"Trabalhar","Sair");
return 1;
}
stock GetCloseWorkPlace(playerid,&Float:x,&Float:y,&Float:z,&place[])
{
new distance[MAX_PLACES];
//distance[3] = GetPlayerDistanceFromPoint(playerid,20.0,20.0,10.0);
distance[1] = GetPlayerDistanceFromPoint(playerid,10.0,10.0,10.0);
distance[0] = GetPlayerDistanceFromPoint(playerid,0.0,0.0,10.0);
/*if(distance[2] < distance[1])
{
x = 20.0; y = 20.0; z = 10.0;
place[24] = "Pizzaria";
}*/
if(distance[1] < distance[0])
{
x = 10.0; y = 10.0; z = 10.0;
place[24] = "Advocacia";
}
if(distance[1] > distance[0])
{
x = 0.0; y = 0.0; z = 10.0;
place[24] = "Lixeira";
}
}
new Float: flo_working_places [ ] [ ]
{
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */,
/* X */, /* Y */, /* Z */
};
YCMD:trabalhar(playerid, params[], help)
{
for ( new wp = 0; wp < sizeof flo_working_places; wp++ )
{
if ( IsPlayerInRangeOfPoint ( playerid, 20, flo_working_places [ wp ] [ 0 ],flo_working_places [ wp ] [ 1 ],flo_working_places [ wp ] [ 2 ] ) )
{
/*Funзхes de botar o jogador para trabalhar*/
return 1;
}
}
SendClientMessage ( playerid, -1, "Vocк nгo estб em nenhum posto de trabalho!" );
return 1;
}
|
pawn Код:
|

enum locs
{
Name[50],
Float:X,
Float:Y,
Float:Z,
ParaName[50],
Float:PX,
Float:PY,
Float:PZ
};
new Locais[][locs] =
{
{"Usina", 292.2992, 1416.2694, 10.7145, "24/7", 1348.5021, -1751.2698, 13.9576}
};
command(trabalhar, playerid, params[])
{
if(PlayerInfo[playerid][pClass] == TEAM_TRUCK)
{
if(GetVehicleTrailer(GetPlayerVehicleID(playerid)))
{
for ( new wp = 0; wp < sizeof Locais; wp++ )
{
if(IsPlayerInRangeOfPoint(playerid, 20,Locais[wp][X],Locais[wp][Y],Locais[wp][Z]))
{
/*Funзхes de botar o jogador para trabalhar*/
return 1;
}
}
}else SendClientMessage(playerid, -1,"[ERRO] Vocк nгo tem carroceria.");
}
return true;
}