30.11.2013, 17:15
I created a "setvip" command, but sadly I've failed again ;______;
I keep having the message "ID blabla is already a vip", even though i have it set to 0 OnPlayerConnect.
Codes:
EDIT: I have every include/plugin etc. up-to-date
I keep having the message "ID blabla is already a vip", even though i have it set to 0 OnPlayerConnect.
Codes:
pawn Код:
CMD:setvip(playerid, params[]) {
new id;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - Only admins can use this command!");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] - Player not found!");
if(PlayerInfo[id][pVip] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "[VIP] - That player is already a VIP.");
new string[128],pname[MAX_PLAYER_NAME],recievername[MAX_PLAYER_NAME];
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "[USAGE] - /setvip [ID]");
GetPlayerName(playerid,pname,sizeof(pname));
GetPlayerName(id,recievername,sizeof(recievername));
format(string, sizeof(string), "[ADMIN] - %s[%d] has used SETVIP on %s[%d]", pname, playerid, recievername, id);
SendMessageToAdmins(string);
format(string, sizeof(string), "[VIP] - Admin %s[%d] has set you as a vip, congratulations!", pname, playerid);
SendClientMessage(id, COLOR_GREEN, string);
SendClientMessage(id, COLOR_GREEN, "[VIP] - As a VIP, you can now use /vipcmds!");
PlayerInfo[id][pVip] = 1;
return 1;
}
pawn Код:
//OnPlayerConnect
PlayerInfo[playerid][pVip] = 0;