17.11.2011, 11:04
pawn Код:
#include <a_samp>
#include <Dini>
#define Branco 0xFFFFFFFF
#define Cor_PMilitar 0x0000FFFF
#define Cor_Grove 0x008000FF
#define Cor_Ballas 0x800080FF
enum Info
{
PMilitar,
Groove,
Ballas
}
new PlayerInfo[MAX_PLAYERS][Info];
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new tmp[128],idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd,"/convidarr", true)==0)
{
tmp = strtok(cmdtext, idx);
new PlayerB;
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF,"uso correto:/convidar [ID]");
PlayerB = strval(tmp);
if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, 0xFFFFFFFF,"Jogador nao conectado");
if(PlayerInfo[playerid] [PMilitar] >= 6)
{
PlayerInfo[PlayerB] [PMilitar] = 1;
SendClientMessage(PlayerB, Branco,"Voce entrou na Policia militar");
SetPlayerColor(PlayerB, Cor_PMilitar);
return 1;
}
else if(PlayerInfo[playerid][Groove] >=6)
{
PlayerInfo[PlayerB][Groove] = 1;
SendClientMessage(PlayerB,Branco,"Voce entrou para groove");
SetPlayerColor(PlayerB, Cor_Grove);
return 1;
}
else if(PlayerInfo[playerid][Ballas] >=6)
{
PlayerInfo[PlayerB][Ballas] = 1;
SendClientMessage(PlayerB,Branco,"Voce entrou nos Ballas");
SetPlayerColor(PlayerB, Cor_Ballas);
return 1;
}
return 1;
}
if(strcmp(cmd, "/promoverr", true) == 0)
{
tmp = strtok(cmdtext, idx);
new PlayerB, level;
if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /promover [id] [cargo]");
PlayerB = strval(tmp);
if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, Branco, "Este jogador nгo estб conectado");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /promover [id] [cargo]");
level = strval(tmp);
if(level < 1 || level > 6) return SendClientMessage(playerid, Branco, "O level deve ser maior que 0 e menor que 7");
new string[128], promovedor[MAX_PLAYER_NAME];
GetPlayerName(playerid, promovedor, sizeof(promovedor));
if(PlayerInfo[playerid][PMilitar] >= 6)
{
if(PlayerInfo[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, Branco, "Este jogador nгo й da sua org");
PlayerInfo[PlayerB][PMilitar] = level;
format(string, sizeof(string), "Vocк foi promovido a level %d por %s", level, promovedor);
SendClientMessage(PlayerB, Branco, string);
return 1;
}
else if(PlayerInfo[playerid][Groove] >= 6)
{
if(PlayerInfo[PlayerB][Groove] < 1) return SendClientMessage(playerid, Branco, "Este jogador nгo й da sua org");
PlayerInfo[PlayerB][Groove] = level;
format(string, sizeof(string), "Vocк foi promovido a level %d por %s", level, promovedor);
SendClientMessage(PlayerB, Branco, string);
return 1;
}
else if(PlayerInfo[playerid][Ballas] >= 6)
{
if(PlayerInfo[PlayerB][Ballas] < 1) return SendClientMessage(playerid, Branco, "Este jogador nгo й da sua org");
PlayerInfo[PlayerB][Ballas] = level;
format(string, sizeof(string), "Vocк foi promovido a level %d por %s", level, promovedor);
SendClientMessage(PlayerB, Branco, string);
return 1;
}
return 1;
}
if(strcmp(cmd, "/demitirr", true) == 0)
{
tmp = strtok(cmdtext, idx);
new PlayerB, string[128], demitidor[MAX_PLAYER_NAME];
if(!strlen(tmp)) return SendClientMessage(playerid, Branco, "Uso correto: /demitir [id]");
PlayerB = strval(tmp);
GetPlayerName(playerid, demitidor, sizeof(demitidor));
if(!IsPlayerConnected(PlayerB)) return SendClientMessage(playerid, Branco, "Este jogador nгo estб conectado");
if(PlayerInfo[playerid][PMilitar] >= 6)
{
if(PlayerInfo[PlayerB][PMilitar] < 1) return SendClientMessage(playerid, Branco, "Este jogador nгo й da sua organizaзгo");
PlayerInfo[PlayerB][PMilitar] = 0;
format(string, sizeof(string), "Vocк foi demitido por %s", demitidor);
SendClientMessage(PlayerB, Branco, string);
return 1;
}
else if(PlayerInfo[playerid][Groove] >= 6)
{
if(PlayerInfo[PlayerB][Groove] < 1) return SendClientMessage(playerid, Branco, "Este jogador nгo й da sua organizaзгo");
PlayerInfo[PlayerB][Groove] = 0;
format(string, sizeof(string), "Vocк foi demitido por %s", demitidor);
SendClientMessage(PlayerB, Branco, string);
return 1;
}
else if(PlayerInfo[playerid][Ballas] >= 6)
{
if(PlayerInfo[PlayerB][Ballas] < 1) return SendClientMessage(playerid, Branco, "Este jogador nгo й da sua organizaзгo");
PlayerInfo[PlayerB][Ballas] = 0;
format(string, sizeof(string), "Vocк foi demitido por %s", demitidor);
SendClientMessage(PlayerB, Branco, string);
return 1;
}
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
forward SalvarOrg(playerid);
public SalvarOrg(playerid)
{
new arquivo[60], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), "Contas\%s.ini", nome);
if(!dini_Exists(arquivo))
{
dini_Create(arquivo);
}
if(PlayerInfo[playerid][PMilitar] > 0) dini_IntSet(arquivo, "PMilitar", PlayerInfo[playerid][PMilitar]);
if(PlayerInfo[playerid][Groove] > 0) dini_IntSet(arquivo, "Groove", PlayerInfo[playerid][Groove]);
if(PlayerInfo[playerid][Ballas] > 0) dini_IntSet(arquivo, "Ballas", PlayerInfo[playerid][Ballas]);
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
index++;
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}