22.02.2012, 15:35
How would I start off by making a command /follow [ID] for the Police where it will keep a Red Marker on them?
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;
}
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;
}