How to make a /follow [ID] - 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)
+--- Thread: How to make a /follow [ID] (
/showthread.php?tid=320312)
How to make a /follow [ID] -
F9 - 22.02.2012
How would I start off by making a command /follow [ID] for the Police where it will keep a Red Marker on them?
Re: How to make a /follow [ID] -
Vince - 22.02.2012
SetPlayerMarkerForPlayer
Re: How to make a /follow [ID] -
Toreno - 22.02.2012
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[] )
{
new
cmd[ 128 ],
tmp[ 128 ],
idx
;
cmd = strtok( cmdtext, idx );
if( !strcmp( cmd, "/follow", true ) )
{
tmp = strtok( cmdtext, idx );
if( !strlen( tmp ) )
return SendClientMessage( playerid, -1, "USAGE: /follow [playerid]" );
SetPlayerMarkerForPlayer( playerid, strval( tmp ), 0xFF0000FF );
return 1;
}
return 0;
}
pawn Код:
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Re: How to make a /follow [ID] -
Jochemd - 22.02.2012
Oh please, don't tell them to use strtok but use sscanf
Re: How to make a /follow [ID] -
Toreno - 22.02.2012
I don't know what he uses, nor tell him what to use.
EDIT: All I did was showing him how the command does what it does.