#include <a_samp>
#include <zcmd>
#include <sscanf>
enum pInfo // This it's our enum !
{ // Open bracket !
LeaderReporter, // This it's the leader of reporter. We'll use it when we will make command "/setleader"
MemberReporter, // This it's Reporter Member. We'll use it when Leader will use /invite command !
NONE // NONE = He doesn't have any faction. When he get kicked from one !
} // Closing bracket
new PlayerInfo[MAX_PLAYERS][pInfo]; // Define the PlayerInfo
CMD:setreporter(playerid, params[])
{
new Level; // This it's variable for Level. If Level = 0, then he isn't Leader, if 1 = He it's leader !
new ID; // This it's variable for that playerid we'll invite to be Faction Leader !
if(IsPlayerAdmin(playerid)) // We check if he it's RCON !
{ // Open bracket !
if(sscanf(params,"ui", ID, Level)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/SetReporter [ID] [0-1] "); // He will saw Usage 1
PlayerInfo[ID][LeaderReporter] = Level; // Will set Leader to that playerid
SendClientMessage(playerid, -1, "{FFCC33}* Information: {FFFFFF}You received leader to {0066CC}Reporter's Faction !"); // He will saw this message, change it, if you don't like !
} // Close bracket !
else // Else, if he doesn't have RCON Admin !
{ // Open bracket !
SendClientMessage(playerid, -1, "{15FF00}EROR: {FF0000}You aren't RCON!"); // He will saw this message !
} // Close bracket !
return 1; // Returns 1 to value !
} // Close bracket !
CMD:invite(playerid, params[])
{ // Open bracket !
if(PlayerInfo[LeaderReporter] >= 1) // If he it's reporter !
{ // Open bracket !
new ID; // This it's variable for ID, wich leaders invite them to them faction !
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/Invite [ID]"); // He will saw usage !
PlayerInfo[ID][Reporter] = 1; // Will sets Reporter to him !
SendClientMessage(playerid, -1, "(( {FFCC33}Inforamation: {15FF00}You added specified player in your faction ! {FFFFFF}))"); // This will saw leader !
SendClientMessage(ID, -1, "(( {FFCC33}Information: {15FF00}You entered in Reporter's faction ! {FFFFFF))"); // This will saw the player !
} // Close bracket !
else // Else, if he isn't Reporters's Leader !
{ // Open bracket !
SendClientMessage(playerid, -1, "{15FF00}ERROR: {FF0000}You aren't Reporter's Leader !"); // He will saw this message !
} // Close Bracket !
return 1; // Returns the value !
} // Close last bracket !
CMD:factionkick(playerid, params[])
{ // Open Bracket !
if(PlayerInfo[LeaderReporter] >= 1) // Check if it's Reporter's Leader !
{ // Open bracket !
new ID; // Variable for ID, wich leaders will kick him from faction !
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/FactionKick [ID]"); // He will saw usage !
PlayerInfo[ID][None] = 1; // He got NONE faction, or he become civilian !
SendClientMessage(playerid, -1, "(( {FFCC33}Information: {15FF00}You kicked specified player from faction ! {FFFFFF}))"); // Leaders will saw this message !
SendClientMessage(ID, -1, "(( {FFCC33}Information: {15FF00}You got kicked from Reporter's faction! {FFFFFF))"); // Player who got kicked from faction will saw this !
} // Close bracket !
else // Else, if he isn't Reporter Leader !
{
SendClientMessage(playerid, -1, "{15FF00}ERROR: {FF0000}You aren't Reporter Leader !"); // He will see this message !
} // Close bracket !
return 1; // Returns the value !
} // Close last bracket !
CMD:ann(playerid, params[])
{ // Open bracket !
if(PlayerInfo[playerid][MemberReporter] >= 1) // If he's Reporter Member !
{ // Open bracket !
new string[128]; // New variable for format string !
if(isnull(params)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/ANN [Text]");
new PlayerName[MAX_PLAYER_NAME+1]; // The string to store the name.
GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); // We get the player name.
format(string, sizeof(string), "{FF0000}Reporter: {15FF00}%s {FFFF00}: {FFCC33}%s", PlayerName, params); // And this it's the text format !
SendClientMessageToAll(-1, string); // Will send format to all players !
} // Close bracket !
else // Else, if he isn't Member of Reporters !
{ // Open bracket !
SendClientMessage(playerid, -1, "{15FF00}ERROR: {FF0000}You aren't Reporter Member"); // He will saw this message !
} // Close bracket !
return 1; // Returns the value !
} // Close last bracket !
#include <a_samp>
new Veh; // Vehicle 1
new Veh2; // Vehicle 2
new Veh3; // Vehicle 3
new Veh4; // Vehicle 4
public OnGameModeInit() // public
{ // Open bracket
Veh = AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2) // Vehicle 1
Veh2 = AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2) // Vehicle 2
Veh3 = AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2) // Vehicle 3
Veh4 = AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2) // Vehicle 4
return 1; // Returns value !
} // Close bracket !
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{ // Open bracket !
if(vehicleid = Veh || Veh2 || Veh3 || Veh4) // If enters only in Veh1, Veh2, Veh3, Veh4
{
if(PlayerInfo[playerid][MemberReporter] >= 1) // Checks if he it's Reporter !
{ // Open bracket !
SendClientMessage(playerid, -1, "Welcome in your faction car !"); // Sends message !
} // Close bracket !
} // Close brackets !
else // If he isn't in that faction !
{ // Open bracket !
SendClientMessage(playerid, -1, "This car it's only for factions !"); // Sends Message !
RemovePlayerFromVehicle(playerid); // Remove it from vehicle !
} // Close bracket !
return 1; // Retruns the value !
} // Close last bracket !
if(sscanf(params,"i", ID, Level))
if(sscanf(params,"ui", ID, Level))
Awesome! damn you really release too much things hahaha joking keep it up my friend.
|
Good job, It'd be awesome to see a save system for it using MySQL.
|
Change this
pawn Код:
pawn Код:
Because "i" detects only playerids, but "u" detects player names and ids too |
- SSCANF - it's a command processor too