Help with a command. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with a command. (
/showthread.php?tid=235046)
Help with a command. -
iGetty - 04.03.2011
pawn Код:
{
if (strcmp("/dishwasher", cmdtext, true, 10) == 0)
{
{
SetPlayerCheckpoint(playerid, HotPoint1, 3.0);
GameTextForPlayer(playerid, "~g~You started the job, good luck!", 3000, 4);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
SendClientMessageToAll(COLOR_RED, string);
return 1;
}
}
return 0;
}
Okay, so I have got this far, now I wanna know, how can I add to that, a position to do the job? for ex., The job was to be started at blueberry, and if not in that place, it sends: You must be in [the place] to do this job.
Please help,
thanks in advance.
AW: Help with a command. -
Nero_3D - 04.03.2011
use
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, Float: range, Float: x, Float: y, Float: z))
Re: AW: Help with a command. -
iGetty - 04.03.2011
Quote:
Originally Posted by Nero_3D
use
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, Float: range, Float: x, Float: y, Float: z))
|
How would i add it to the script?
Re: Help with a command. -
antonio112 - 05.03.2011
Try something like this:
pawn Код:
{
if (strcmp("/dishwasher", cmdtext, true, 10) == 0)
{
if( IsPlayerInRangeOfPoint( playerid,dist, X, Y, Z )
{
SetPlayerCheckpoint(playerid, HotPoint1, 3.0);
GameTextForPlayer(playerid, "~g~You started the job, good luck!", 3000, 4);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
SendClientMessageToAll(COLOR_RED, string);
return 1;
}
else SendClientMessage( playerid, -1, "You are not at the job possition." );
}
return 0;
}
Now, dist means the distance from the point (pickup, where you use /dishwasher) you want, try something like 1.5.
X,Y,Z are the job coordinates, where exactly you want the /dishwasher command to work.
ps: I don`t see the point of:
pawn Код:
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
SendClientMessageToAll(COLOR_RED, string);
You have any idea why is it there?
Re: Help with a command. -
NiXeL - 05.03.2011
Код:
if(strcmp("/dishwasher", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,dist, X, Y, Z) // Change X Y Z to your point
{
SetPlayerCheckpoint(playerid, HotPoint1, 3.0);
GameTextForPlayer(playerid, "~g~You started the job, good luck!", 3000, 4);
return 1;
}
else SendClientMessage(playerid, COLOR_WHITE, "Server: You are not at the job possition!");
}
Re: Help with a command. -
OKStyle - 05.03.2011
Or just create pickup