#define FILTERSCRIPT
//Credits to samp
#include <a_samp>
//Credits to Zeex for zcmd
#include <zcmd>
//Credits to ****** for foreach
#include <foreach>
//Credits to ****** for sscanf
#include <sscanf>
#include <dini>
//Credits to me folor colors
#define COLOR_RED 0xF00F00
#define COLOR_GREEN 0xFF000FFF
#define MAX_VIP 3
#define PlayerFile "Vip/%s.ini"
#pragma tabsize 0
enum dData
{
Vip
}
new PlayerInfo[MAX_PLAYERS][dData];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Vip system loaded!");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),PlayerFile,name);
if(!dini_Exists(file) )
{
dini_Create(file);
dini_Set(file,"Name",name);
dini_IntSet(file,"Vip",0);
PlayerInfo[playerid][Vip] = 0;
SendClientMessage(playerid,COLOR_RED,"Your vip level is 0; !");
}
else
{
PlayerInfo[playerid][Vip] = dini_Int(file,"Vip");
new string[256];
format(string,sizeof(string),"Your vip level is %d",PlayerInfo[playerid][Vip]);
SendClientMessage(playerid,COLOR_GREEN,string);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),PlayerFile,name);
if(dini_Exists(file) )
{
dini_IntSet(file,"Vip",PlayerInfo[playerid][Vip]);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
if(text[0] == '!' )
{
if(PlayerInfo[playerid][Vip] > 0)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
new string[256];
format(string,sizeof(string),"Vip -- %s ( rank: %d): %s",name,PlayerInfo[playerid][Vip],text[0]);
MessageToVips(COLOR_GREEN,string);
return 0;
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
CMD:setvip(playerid,params[])
{
new id, level;
if(sscanf(params,"ud",id,level) ) return SendClientMessage(playerid,COLOR_RED,"USUAGE: /setvip [id][ level]");
if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin!");
if(level > MAX_VIP) return SendClientMessage(playerid,COLOR_RED,"Invalid Level");
if(!IsPlayerConnected(id) ) return SendClientMessage(playerid,COLOR_RED,"Player is not connected");
else
{
new name[MAX_PLAYER_NAME], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id,playername,sizeof(playername));
new fstring[256], zstring[256];
format(fstring,sizeof(fstring),"Administrator %s maked you V.I.P level %d",name,level);
format(zstring,sizeof(zstring),"You maked %s level %d",playername,level);
SendClientMessage(playerid,COLOR_RED,zstring);
SendClientMessage(id,COLOR_RED,fstring);
PlayerInfo[id][Vip] = level;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//mesage to vips
stock MessageToVips(color, const string[])
{
foreach(Player,i)
{
if(IsPlayerConnected(i) == 1)
if(PlayerInfo[i][Vip] >= 1)
SendClientMessage(i,color,string);
}
}
CMD:setvip(playerid,params[])
{
new id, level;
if(sscanf(params,"ud",id,level) ) return SendClientMessage(playerid,COLOR_RED,"USUAGE: /setvip [id][ level]");
printf("level : %i",level);
if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin!");
if(level > MAX_VIP) return SendClientMessage(playerid,COLOR_RED,"Invalid Level");
if(!IsPlayerConnected(id) ) return SendClientMessage(playerid,COLOR_RED,"Player is not connected");
else
{
new name[MAX_PLAYER_NAME], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id,playername,sizeof(playername));
new fstring[256], zstring[256];
new tempVar = 1;
format(fstring,sizeof(fstring),"Administrator %s maked you V.I.P level %d",name,tempVar);
format(zstring,sizeof(zstring),"You maked %s level %d",playername,tempVar);
SendClientMessage(playerid,COLOR_RED,zstring);
SendClientMessage(id,COLOR_RED,fstring);
PlayerInfo[id][Vip] = level;
}
return 1;
}
CMD:setvip(playerid,params[])
{
new targetId, level;
if(sscanf(params,"ud", targetId, level) ) return SendClientMessage(playerid,COLOR_RED,"USUAGE: /setvip [id][ level]");
if(!IsPlayerAdmin(playerid) ) return SendClientMessage(playerid,COLOR_RED,"You are not an admin!");
if(level > MAX_VIP) return SendClientMessage(playerid,COLOR_RED,"Invalid Level.");
if(!IsPlayerConnected(targetId) ) return SendClientMessage(playerid,COLOR_RED,"Player is not connected.");
new adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminName, sizeof(adminName));
GetPlayerName(targetId, targetName, sizeof(targetName));
new targetMessage[90], adminMessage[70];
format(targetMessage,sizeof(targetMessage),"Administrator %s has set your V.I.P level to %d.", name, level);
format(adminMessage,sizeof(adminMessage),"You have set %s's V.I.P level %d.", targetName, level);
SendClientMessage(playerid,COLOR_RED,adminMessage);
SendClientMessage(targetId,COLOR_RED,targetMessage);
PlayerInfo[targetId][Vip] = level;
return 1;
}
I see you do not use sscanf2 but just sscanf.
Try updating your sscanf. It might be that "u" came with sscanf version 2. |
he might just have renamed the file tho, thats what i did at least
|
I guess it's a pretty good explanation why his command didn't work so I don't think it's just renamed ^^
|
I see you do not use sscanf2 but just sscanf.
Try updating your sscanf. It might be that "u" came with sscanf version 2. |