23.06.2011, 17:07
PHP код:
#include <a_samp>
#include <Dini>
new VIP[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new file[30], n[24];
GetPlayerName(playerid, n, 24);
format(file, 30, "%s.txt", n);
if(fexist(file)) { VIP[playerid] = dini_Int(file, "VIP"); }
else
{
dini_Create(file);
VIP[playerid] = 0;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[30], n[24];
GetPlayerName(playerid, n, 24);
format(file, 30, "%s.txt", n);
dini_IntSet(file, "VIP", VIP[playerid]);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kitvipo", true) == 0)
{
if(VIP[playerid] < 3) return SendClientMessage(playerid, -1, "Vocк nгo й Vip Ouro.");
GivePlayerWeapon(playerid, 24, 3000);
GivePlayerWeapon(playerid, 29, 3000);
GivePlayerWeapon(playerid, 31, 3000);
SetPlayerArmour(playerid, 90);
return 1;
}
if(strcmp(cmd, "/kitvipp", true) == 0)
{
if(VIP[playerid] < 2) return SendClientMessage(playerid, -1, "Vocк nгo й Vip Prata.");
GivePlayerWeapon(playerid, 24, 2000);
GivePlayerWeapon(playerid, 29, 2000);
GivePlayerWeapon(playerid, 31, 2000);
SetPlayerArmour(playerid, 80);
return 1;
}
if(strcmp(cmd, "/kitvipb", true) == 0)
{
if(VIP[playerid] < 1) return SendClientMessage(playerid, -1, "Vocк nгo й Vip Bronze.");
GivePlayerWeapon(playerid, 24, 1000);
GivePlayerWeapon(playerid, 29, 1000);
GivePlayerWeapon(playerid, 31, 1000);
SetPlayerArmour(playerid, 70);
return 1;
}
if(strcmp(cmd, "/vips", true) == 0)
{
new str[128], n[24];
for(new i = 0; i < MAX_PLAYERS; i ++)
{
GetPlayerName(i, n, sizeof(n));
if(VIP[i] == 1) { format(str, sizeof(str), " » %s - {00FF0C}Vip Bronze", n); }
else if(VIP[i] == 2) { format(str, sizeof(str), " » %s - {303AFF}Vip Prata", n); }
else if(VIP[i] == 2) { format(str, sizeof(str), " » %s - {FFFE10}Vip Ouro", n); }
SendClientMessage(playerid, -1, str);
}
return 1;
}
if(strcmp(cmd, "/chatvip", true) == 0)
{
if(VIP[playerid] < 1) return SendClientMessage(playerid, -1, "Vocк nгo й Vip.");
new string[256], n[24];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, -1, "USO: /chatvip [TEXTO]");
GetPlayerName(playerid, n, sizeof(n));
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(VIP[i] > 0)
{
format(string, sizeof(string), "{FCF405}[CHAT VIP]{FFFFFF} %s: %s", n, result);
SendClientMessage(i, -1, string);
}
}
return 1;
}
if(strcmp(cmd, "/darvip", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo estб logado na RCON.");
new tmp[256], id, lvl, str[128], n[24], n2[24];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USO: /darvip [ID] [LEVEL]");
id = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USO: /darvip [ID] [LEVEL]");
lvl = strval(tmp);
VIP[id] = lvl;
GetPlayerName(playerid, n, 24);
GetPlayerName(id, n2, 24);
format(str, sizeof(str), "O ADMIN %s te deu VIP level %d.", n, lvl);
SendClientMessage(id, -1, str);
format(str, sizeof(str), "Vocк deu VIP level %d para o jogador %s.", lvl, n2);
SendClientMessage(playerid, -1, str);
return 1;
}
return 0;
}