Doubt
#1

Ok so, i have almost 50 admin commands and i'm planning to add more. Since most of them (i'd say 99%), have some basilar checks, this to be clear:

pawn Code:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Player is not connected.");
if(id == playerid) returnSendClientMessage(playerid, -1, "You can't use this command on yourself.");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid playername/id.");
I was thinking, it's possible to create a function that has this checks and return error messages in case?

I mean something like: BasicPlayerChecks(id);

Then in the command, imagine i type an invalid playername/id, it will return: "Invalid playername/id" calling the id == INVALID_PLAYER_ID check.

How? Hope i've been clear.
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)