(HELP) Removing License
#1

How can I add to this script removing license please?
That can use only cops pMember = 1, pLeader = 1
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new
    cmd[256], tmp[256], string[128], idx,
    o_name[MAX_PLAYER_NAME], p_name[MAX_PLAYER_NAME]
    ;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/dlicense", true) == 0)
        {
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /dlicense [ID]");
        new id = strval(tmp);
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "SERVER: playerid is not connected");
        new Float:x[3];
        GetPlayerPos(playerid,x[0],x[1],x[2]);
        if(IsPlayerConnected(id))
        if(IsPlayerInRangeOfPoint(id,4.0,x[0],x[1],x[2]))
        {
            GetPlayerName(id, o_name, sizeof(o_name));
            GetPlayerName(playerid, p_name, sizeof(p_name));
            format(string, sizeof(string), "CarLicenses/%s.ini", o_name);
            if(!fexist(string)) {
                format(string, sizeof(string), "%s Driving License : NOT PASSED.", p_name);
                SendClientMessage(id, -1, string);
                format(string, sizeof(string), " You have showed your license to %s.", o_name);
                SendClientMessage(playerid, -1, string);
            } else {
                format(string, sizeof(string), "%s Driving License : PASSED.", p_name);
                SendClientMessage(id, -1, string);
                format(string, sizeof(string), "You have showed your license to %s.", o_name);
                SendClientMessage(playerid, -1, string);
            }
            return 1;
        }
        else
        {
            SendClientMessage(playerid,0xFF0000FF,"This player is too far away!");
        }
        printf("LICENSE: [%d]%s showed [%d]%s his license.", playerid, p_name, id, o_name);
        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;
}
Reply
#2

Didn't I gave you this in PM?
Reply
#3

You would need to add a check under the command:
pawn Код:
if( PlayerInfo[ playerid ][ pMember ] != 1 || PlayerInfo[ playerid ][ pLeader ] != 1 )
   return SendClientMessage( playerid, 0xFF0000FF, "You cannot use this command!" );
Not to mention, the coding practices in that code is horrendous. I suggest you read some guides by ******:

https://sampforum.blast.hk/showthread.php?tid=55261
https://sampforum.blast.hk/showthread.php?tid=166680
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)