02.02.2012, 10:28
Hey guys, i need some help to teach me how to use arrays.
I have got this code:
Its work fine but i want to give name for each job (coordinates) cause i want to send a message for a client about name of the job.
For Example
[pawn]
But in this way doesn't work. Anyone can help me? :$
I have got this code:
pawn Code:
new Float:weap_job[3][4] =
{
{1390.3326, -1433.2731, 13.5547}, //1st job
{1173.3326, -1308.5277, 13.9932}, //2nd job
{1246.8691, -1258.9777, 13.1773} //3rd job
};
CMD:work(playerid, params[])
{
new pick = random(sizeof(weap_job));
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle");
{
SetPlayerCheckpoint(playerid, weap_job[pick][0], weap_job[pick][1], weap_job[pick][2], 7.0);
SendClientMessage(playerid, COLOR_RED, "WORKNAME");
}
return 1;
}
For Example
[pawn]
pawn Code:
new Float:weap_job[3][4] =
{
{1390.3326, -1433.2731, 13.5547, "JOBNAME1"}, //1st job
{1173.3326, -1308.5277, 13.9932, "JOBNAME2"}, //2nd job
{1246.8691, -1258.9777, 13.1773, "JOBNAME3"} //3rd job
};
CMD:work(playerid, params[])
{
new pick = random(sizeof(weap_job));
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle");
{
SetPlayerCheckpoint(playerid, weap_job[pick][0], weap_job[pick][1], weap_job[pick][2], 7.0);
SendClientMessage(playerid, COLOR_RED, "weap_job[pick][3]");
}
return 1;
}