pawn Код:
COMMAND:request(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][Leader] >= 1) SendClientMessage(playerid, red, "The leader of this organization is currently online");
else if(IsPlayerConnected(i) && PlayerInfo[i][Leader] < 1) return SendClientMessage(playerid, red, "The leader of this organization is currently not online");
//i dont know what level the leade starts from so i just put 1
}
new id;
new String[MAX_PLAYERS];
if(sscanf(params,"i", id))return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /request [orgid]");
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(playerid, Name, sizeof(Name));
if(PlayerInfo[playerid][IsInOrg] == 1) return SendClientMessage(playerid, red, "You are already in a organization!");
if(PlayerInfo[playerid][IsRequesting] == 1) return SendClientMessage(playerid, red," You are already requesting to join an organization!");
if(PlayerInfo[playerid][Leader] == id || PlayerInfo[playerid][Member] == id) return SCM(playerid, COLOR_GREY, "Your already in this organization");
if(id == 1)
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Police Department.",Name);
SendClientMessageToAll(COLOR_ORANGE,String);
format(File,sizeof(File),AccountLocation, pName);
{
dini_IntSet(File, "Request",PlayerInfo[playerid][request] = 1);
dini_IntSet(File, "Isrequesting",PlayerInfo[playerid][IsRequesting] = 1);
return 1;
}
}
if(id == 2)
{
format(String,MAX_PLAYERS,"* %s is requesting to join National Guard.",Name);
SendClientMessageToAll(COLOR_ORANGE,String);
format(File,sizeof(File),AccountLocation, pName);
{
dini_IntSet(File, "Request",PlayerInfo[playerid][request] = 2);
dini_IntSet(File, "Isrequesting",PlayerInfo[playerid][IsRequesting] = 1);
return 1;
}
}
if(id == 3)
{
format(String,MAX_PLAYERS,"* %s is requesting to join San Andreas Fire Department.",Name);
SendClientMessageToAll(COLOR_ORANGE,String);
format(File,sizeof(File),AccountLocation, pName);
{
dini_IntSet(File, "Request",PlayerInfo[playerid][request] = 3);
dini_IntSet(File, "Isrequesting",PlayerInfo[playerid][IsRequesting] = 1);
return 1;
}
}
if(id == 4)
{
format(String,MAX_PLAYERS,"* %s is requesting to join The Sons Of Anarchy.",Name);
SendClientMessageToAll(COLOR_ORANGE,String);
format(File,sizeof(File),AccountLocation, pName);
{
dini_IntSet(File, "Request",PlayerInfo[playerid][request] = 4);
dini_IntSet(File, "Isrequesting",PlayerInfo[playerid][IsRequesting] = 1);
return 1;
}
}
if(id == 5)
{
format(String,MAX_PLAYERS,"* %s is requesting to join The Grove Street Families.",Name);
SendClientMessageToAll(COLOR_ORANGE,String);
format(File,sizeof(File),AccountLocation, pName);
{
dini_IntSet(File, "Request",PlayerInfo[playerid][request] = 5);
dini_IntSet(File, "Isrequesting",PlayerInfo[playerid][IsRequesting] = 1);
return 1;
}
}
return 1;
}