Doubt
#2

It is possible for sure.

This should work:
pawn Code:
BasicPlayerChecks(playerid, targetid) {
    if(!IsPlayerConnected(targetid)) return 1;
    if(targetid == playerid) return 2;
    if(targetid == INVALID_PLAYER_ID) return 3;
   
    return false; //false and 0 are the same thing
}

SendErrorMessage(playerid, messageid, color = -1) {
    new message[64];
    switch(messageid) {
        case 1: strcat(message, "Player is not connected.");
        case 2: strcat(message, "You can't use this command on yourself.");
        case 3: strcat(message, "Invalid playername/id.");
    }
   
    return SendClientMessage(playerid, color, message);
}
Use it like so:
pawn Code:
if(BasicPlayerChecks(playerid, id)) return SendErrorMessage(playerid, BasicPlayerChecks(playerid, id));
or (don't call the function twice)
pawn Code:
new BPC = BasicPlayerChecks(playerid, id);
if(BPC) return SendErrorMessage(playerid, BPC);
Alternatively you can try SmartCMD by Yashas: https://sampforum.blast.hk/showthread.php?pid=3786819#pid3786819
Reply


Messages In This Thread
Doubt - by SymonClash - 24.03.2019, 17:35
Re: Doubt - by bgedition - 24.03.2019, 17:56
Re: Doubt - by SymonClash - 24.03.2019, 17:58
Re: Doubt - by Hazon - 25.03.2019, 10:55
Re: Doubt - by SymonClash - 25.03.2019, 11:27

Forum Jump:


Users browsing this thread: 1 Guest(s)