How to make a /follow [ID]
#1

How would I start off by making a command /follow [ID] for the Police where it will keep a Red Marker on them?
Reply
#2

SetPlayerMarkerForPlayer
Reply
#3

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;
}
Reply
#4

Oh please, don't tell them to use strtok but use sscanf
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)