GameMode problem
#1

My gamemode does not function properly. The compiled commands do not show as in the .pwn and most commands do not work.

Here is the gamemode:
Код:
// Basic Gamemode Script made by Axel
// DO NOT REMOVE CREDITS



//Includes
#include <a_samp>
#include <zcmd>
#include <YSI/y_ini>
#include <sscanf2>
#include <crashdetect>

//Defines
#define SCM   SendClientMessage
#define SCMToAll   SendClientMessageToAll
#define pid   playerid
#define SPH   SetPlayerHealth
#define SPSA  SetPlayerSpecialAction
#define STOP_ANIM   "Press the F key to stop the animation"
#define ADMIN_MESSAGE   "You are not allowed to use this command"


//Enum
enum PlayerInfo
{
	pAdmin,
	pHelper,
	pVip
}

//New
new gPlayer_Duty[MAX_PLAYERS];
new Player[MAX_PLAYERS][PlayerInfo];

// Stock

stock SendAdminMessage(const color, const message[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    printf("Player %i <pAdmin: %i>", i, Player[i][pAdmin]);
	    if(Player[i][pAdmin] >= 4)
	    {
	        printf("Found player %i, sending message", i);
	        SendClientMessage(i, color, message);
		}
	}
    return 1;
}
//Server Properties
#define SERVER_NAME   "[0.3.7]JXF's server."
#define SERVER_PASSWORD   ""
#define SERVER_VERSION "V1.0"
#define SERVER_RCON   "Parola123"
#define SERVER_MAP   "Your map name here"
#define SERVER_FORUM "Your forum here"
#define weburl   "Your website here"
#define SERVER_TEAMSPEAK "Your teamspeak here"

//Color Defines
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x243DD5
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xF9AFBC
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA 
#define COLOR_YELLOWGREEN 0x9ACD32AA 
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA 
#define DIALOG_REGISTER 2000
#define DIALOG_LOGIN 2001
#define WHITE "{FFFFFF}"
#define RED "{F81414}"
#define GREEN "{00FF22}"
#define LIGHTBLUE "{00CED1}"

main()
{
    SendRconCommand("hostname "SERVER_NAME);
    SendRconCommand("rcon_password "SERVER_RCON);
    SendRconCommand("gamemodetext "SERVER_VERSION);
	SendRconCommand("mapname "SERVER_MAP);
	SendRconCommand("weburl "SERVER_FORUM);
	SendRconCommand("password "SERVER_PASSWORD);
	printf(""SERVER_NAME" ("SERVER_VERSION"), has been loaded successfully.");
}



public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    SetPlayerPosFindZ(playerid, fX, fY, fZ);
    return 1;
}

//--------------Commands--------------

CMD:suicide(pid,params[])
{
	SPH(pid, 0);
	SCM(playerid, -1, "You have commited suicide!");
	return 1;
}

CMD:heal(pid,params[])
{
	if(IsPlayerAdmin(pid))
	SPH(pid, 100);
	if(!IsPlayerAdmin(pid))
	SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	return 1;
}

CMD:jetpack(pid,params[])
{
	if(IsPlayerAdmin(pid))
	SetPlayerSpecialAction(pid, 2);
	if(!IsPlayerAdmin(pid))
	SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	return 1;
}

CMD:jpoff(pid,params[])
{
	if(IsPlayerAdmin(pid))
	SetPlayerSpecialAction(pid, 0);
	if(!IsPlayerAdmin(pid))
	SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	return 1;
}

CMD:handsup(pid,params[])
{
	SPSA(pid, 10);
	SCM(pid, COLOR_YELLOW, STOP_ANIM);
	return 1;
}

CMD:pee(pid,params[])
{
	SPSA(pid, 68);
	SCM(pid, COLOR_YELLOW, STOP_ANIM);
	return 1;
}

CMD:ahelp(pid,params[])
{
	if(IsPlayerAdmin(pid))
	SCM(pid, COLOR_YELLOW, "OWNER:/heal, /jetpack, /jpoff");
	if(!IsPlayerAdmin(pid))
	SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	return 1;
}

CMD:animhelp(pid,params[])
{
	SCM(pid, -1, "/handsup, /pee,");
	return 1;
}

CMD:info(playerid, params[]) return cmd_information(playerid, params);
CMD:information(playerid, params[])
{
	SCM(playerid, COLOR_WHITE, "---------------------------------------------------");
	SCM(playerid, COLOR_LIGHTBLUE, ""SERVER_NAME" - Info");
	SCM(playerid, COLOR_WHITE, "Version: "SERVER_VERSION"");
	SCM(playerid, COLOR_WHITE, "Webstie: "SERVER_FORUM"");
	SCM(playerid, COLOR_WHITE, "Teamspeak: "SERVER_TEAMSPEAK"");
	SCM(playerid, COLOR_WHITE, "---------------------------------------------------");
	return 1;
}

CMD:restart(pid,params[])
{
	if(IsPlayerAdmin(playerid))
	SendRconCommand("gmx");
	if(!IsPlayerAdmin(playerid))
	SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	return 1;
}

CMD:gun(pid,params[])
{
	if(IsPlayerAdmin(playerid))
	{
			GivePlayerWeapon(pid, 38, 6000);
			GivePlayerWeapon(pid, 24, 6000);
			GivePlayerWeapon(pid, 4, 1);
			SCM(pid, COLOR_LIGHTBLUE, " You have been granted admin weapons.");
	}
	else SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	return 1;
}


public OnPlayerConnect(playerid)
{
	gPlayer_Duty[playerid] = 0;
	return 1;
}

CMD:aod(pid,params[])
{
	if (Player[playerid][pAdmin] < 1) return SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	
	new aod[65], name[MAX_PLAYER_NAME];
	GetPlayerName(pid, name, MAX_PLAYER_NAME);

	if(!gPlayer_Duty[playerid])
	{
 		SPH(pid, 99999);
		SetPlayerArmour(pid, 100);
	
		format(aod, sizeof aod, "Admin %s is now on duty. Use /report for any assistance.", name);
		SCMToAll(COLOR_LIME, aod);

		gPlayer_Duty[playerid] = 1;
	}
	else
	{
 		SPH(pid, 100);
   		SetPlayerArmour(pid, 0);
		format(aod, sizeof aod, "Admin %s is no longer on duty.", name);
		SCMToAll(COLOR_BLUE, aod);

		gPlayer_Duty[playerid] = 0;
	}
	return 1;
}

CMD:hod(pid, params[])
{
	if (Player[playerid][pHelper] < 1) return SCM(pid, COLOR_RED, ADMIN_MESSAGE);
	
	new hod[65], name[MAX_PLAYER_NAME];
	GetPlayerName(pid, name, MAX_PLAYER_NAME);
	
	if(!gPlayer_Duty[playerid])
	{
	    SPH(pid, 99999);
	    SetPlayerArmour(pid, 100);
	    
	    format(hod, sizeof hod, "Helper %s is now on duty. Use /needhelp for any assistance.", name);
	    SCMToAll(COLOR_LIME, hod);
	    
	    gPlayer_Duty[playerid] = 1;
	}
	else
	{
	    SPH(pid, 100);
		SetPlayerArmour(pid, 0);
		format(hod, sizeof hod, "Helper %s is no longer on duty.", name);
		SCMToAll(COLOR_BLUE, hod);
		
		gPlayer_Duty[playerid] = 0;
	}
	return 1;
}


CMD:troll(pid,params[])
{
	if(!IsPlayerAdmin(playerid))
	SCM(pid, COLOR_RED, "Hehehe, you tried!");
	if(IsPlayerAdmin(playerid))
	SCMToAll(COLOR_LIGHTBLUE, "   You have been promoted to a level 1338 Admin by JXF. Use /ah for help.");
	return 1;
}

//----------------------------------[MAKEADMIN]------------------------------------------------
CMD:makeadmin(playerid, params[])
{
    if (Player[playerid][pAdmin] < 1338) return SendClientMessage(playerid, -1, ADMIN_MESSAGE);

    new para1, level;
    if (sscanf(params, "ri", para1, level)) return SendClientMessage(playerid, -1, "{00E6FF}USAGE:{FFFFFF} /makeadmin [IDJucator/ParteDinNume] [level(1-1338)]");
    if (para1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player");
    if (!(1 <= level <= 1338)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 1338");

    new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];

    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));

    Player[para1][pAdmin] = level;

    printf("AdmWarning: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
    format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}admin.", sendername, giveplayer, level);
	SendAdminMessage(-1, string);
	return 1;
}
//--------------Makehelper--------------
CMD:makehelper(playerid, params[])
{
    if (Player[playerid][pHelper] < 4 && Player[playerid][pAdmin] < 1337) return SendClientMessage(playerid, -1, ADMIN_MESSAGE);

    new para1, level;
    if (sscanf(params, "ui", para1, level)) return SendClientMessage(playerid, -1, "{00E6FF}USAGE:{FFFFFF} /makehelper [IDJucator/ParteDinNume] [level(1-4)]");
    if (para1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player");
    if (!(0 <= level <= 4)) return SendClientMessage(playerid, -1, "Invalid level. It must be between 1 and 4");

    new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];

    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));

    Player[para1][pHelper] = level;

    printf("AdmWarning: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
    format(string, sizeof(string), "   You have been promoted to a level %d helper by %s", level, sendername);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "{D11515}[AdmWarning]: {FF9203}%s {FFFFFF}has set {FF9203}%s {FFFFFF}to a level {FF9203}%d {FFFFFF}helper.", sendername, giveplayer, level);
	SendAdminMessage(-1, string);
	return 1;
}

//-------------MAKEVIP-------------
CMD:makevip(playerid, params[])
{
	if (Player[playerid][pAdmin] < 1338 && IsPlayerAdmin(playerid)) return SCM(pid, -1, ADMIN_MESSAGE);
	
	new para1, level;
	if (sscanf(params, "ui", para1, level)) return SendClientMessage(playerid, -1, "{00E6FF}USAGE:{FFFFFF} /makevip [PlayerID/PartOfName] [level (0-2]");
	if (para1 == INVALID_PLAYER_ID) return SCM(pid, -1, "Invalid player");
	if (!(0 <= level <= 2)) return SCM(pid, -1, "It must be between 0 and 2!");
	
	new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[144];
	
	GetPlayerName(para1, giveplayer, sizeof(giveplayer));
	GetPlayerName(playerid, sendername, sizeof(sendername));
	
	Player[para1][pVip] = level;
	
	printf("AdmWarning: %s has set %s's vip level to %d.", sendername, giveplayer, level);
	format(string, sizeof(string)," You have been made a level %d VIP by admin {FF0000}%s .", level, sendername);
	SendClientMessage(para1, COLOR_LIGHTBLUE, string);
	format(string, sizeof(string), "{D11515}[AdmWarning]: {FF9203}%s has set {FF9203}%s to a level {FF9203}%d VIP.", sendername, giveplayer, level);
	SendAdminMessage(-1, string);
	return 1;
}
Код:
[22:21:36] 
[22:21:36] Server Plugins
[22:21:36] --------------
[22:21:36]  Loading plugin: mysql
[22:21:36] 

  > MySQL plugin R5 successfully loaded.

[22:21:36]   Loaded.
[22:21:36]  Loading plugin: sscanf
[22:21:37]   Failed.
[22:21:37]  Loaded 1 plugins.

[22:21:37] 
[22:21:37] Filterscripts
[22:21:37] ---------------
[22:21:37]   Loading filterscript 'fsdebug.amx'...
[22:21:37] 
  *********************
  * SA:MP DEBUG 0.2   *
[22:21:37]   * By Simon Campbell *
  *********************
[22:21:37]   * Version: 0.5c      *
  *********************
[22:21:37]   * -- LOADED         *
  *********************

[22:21:37] AllowAdminTeleport() : function is deprecated. Please see OnPlayerClickMap()
[22:21:37]   Loading filterscript 'infernus.amx'...
[22:21:37] 
--------------------------------------
[22:21:37]  Blank Filterscript by your name here
[22:21:37] --------------------------------------

[22:21:37]   Loading filterscript 'makeadmin.amx'...
[22:21:37]   Loading filterscript 'database.amx'...
[22:21:37]   Loading filterscript 'house.amx'...
[22:21:37]   Loaded 5 filterscripts.

[22:21:37] Script[gamemodes/GM.amx]: Run time error 19: "File or function is not found"
[22:21:37] Number of vehicle models: 1
[22:22:15] [connection] 192.168.0.5:65443 requests connection cookie.
[22:22:16] [connection] incoming connection: 192.168.0.5:65443 id: 0
[22:22:17] [join] JXF has joined the server (0:192.168.0.5)
[22:22:17] AllowPlayerTeleport() : function is deprecated. Please see OnPlayerClickMap()
[22:22:29] [part] JXF has left the server (0:1)
server log
Reply
#2

Which commands doesn't work ? All of your commands is working. (I tested all of your commands).
Just added GetName and changed your loop from SendAdminMessage
PHP код:
stock SendAdminMessage(const color, const message[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(!
IsPlayerConnected(i)) continue;
        
printf("Player %i <pAdmin: %i>"iPlayer[i][pAdmin]);
        if(
Player[i][pAdmin] >= 4)
        {
            
printf("Found player %i, sending message"i);
            
SendClientMessage(icolormessage);
        }
    }
    return 
1;
}
stock GetName(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    return 
name;

NB : Delete your IP adress in the server_log:
PHP код:
[22:22:16] [connectionincoming connectionxxx.xxx.x.x:xxxxx id0
[22:22:17] [joinJXF has joined the server (0:xxx.xxx.x.x
Reply
#3

A glaring thing in the server.log is this...

Код:
[22:21:37] Script[gamemodes/GM.amx]: Run time error 19: "File or function is not found"
Which comes from this

Код:
[22:21:36]  Loading plugin: sscanf
[22:21:37]   Failed.
And would probably give you a bit of trouble. Fix that and it's likely that your script will start working again.


Quote:
Originally Posted by Dayrion
Посмотреть сообщение
NB : Delete your IP adress in the server_log:
Internal IP.
Reply
#4

u may forget to add sscanf plugin
Reply
#5

I do have my sscanf plugin, otherwise it wouldnt work.
Reply
#6

Quote:
Originally Posted by JXF
Посмотреть сообщение
I do have my sscanf plugin, otherwise it wouldnt work.
It just said it failed to load.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)