Taking CMDS in a gamemode and put it in a filterscript [Help]
#1

Hi i would like to take some cmds of a gamemode i have and put it in a filterscript but when im trying i get some errors but i have all the defines and includes needed. Can someone help me? thx
here the code
Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <dudb>
#include <gvar>
#include <time>
#include <dprops>
#pragma unused strtok

cmd(startevent, playerid, params[])
{
	new string[120]; new pname[24]; GetPlayerName(playerid, pname, 24);
	if(GetPVarInt(playerid, "AdminLevel") == 0) return SendClientMessage(playerid, COLOR_ERROR, "Invalid Command. Read /commands.");
	if(GetPVarInt(playerid, "Jailed") == 1) return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command while in jail.");
	if(GetPVarInt(playerid, "Cuffed") == 1) return SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command while cuffed.");
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	SetGVarFloat("EventX", x); SetGVarFloat("EventY", y); SetGVarFloat("EventZ", z); SetGVarInt("EventI", GetPlayerInterior(playerid)); SetGVarInt("EventStarted", 1);
	format(string, 120, "[ADMIN EVENT] Server Admin %s(%d) has started an event. Type /event to join.", pname, playerid);
	SendClientMessageToAll(COLOR_ADMIN, string);
	IRC_Say(gGroupID, IRC_CHANNEL, string);
	SendClientMessage(playerid, COLOR_GREEN, "You have started an event. Type /endevent to end it.");
	return 1;
}
cmd(event, playerid, params[])
{
	if(GetGVarInt("EventStarted") == 0) return SendClientMessage(playerid, COLOR_ERROR, "There's no event started.");
	SendClientMessage(playerid, COLOR_GREEN, "You have joined the Admin Event.");
	SetPlayerPos(playerid, GetGVarFloat("EventX"), GetGVarFloat("EventY"), GetGVarFloat("EventZ"));
	SetPlayerInterior(playerid, GetGVarInt("EventI"));
	SetPVarInt(playerid, "InEvent", 1);
	return 1;
}
cmd(endevent, playerid, params[])
{
	new pname[24]; new string[120]; GetPlayerName(playerid, pname, 24);
	if(GetPVarInt(playerid, "AdminLevel") == 0) return SendClientMessage(playerid, COLOR_ERROR, "Invalid Command. Read /commands");
	if(GetGVarInt("EventStarted") == 0) return SendClientMessage(playerid, COLOR_ERROR, "There's no event started.");
	SetGVarInt("EventStarted", 0);
	format(string, 120, "[ADMIN EVENT] Admin %s(%d) has ended the current event. You can no longer join.", pname, playerid);
	SendClientMessage(playerid, COLOR_ADMIN, string);
	return 1;
}
cmd(eventweapon, playerid, params[])
{
	new weapon; new ammo;
	if(GetPVarInt(playerid, "AdminLevel") == 0) return SendClientMessage(playerid, COLOR_ERROR, "Invalid Command.");
	//if(GetGVarInt("EventStarted") == 0) return SendClientMessage(playerid, COLOR_ERROR, "There's no event started.");
	if(sscanf(params, "ii", weapon, ammo)) return SendClientMessage(playerid, COLOR_ERROR, "Usage: /eventweapon (WeaponID) (Ammo)");
	for(new i = 0; i<MAX_PLAYERS; i ++)
	{
	    if(GetPVarInt(i, "InEvent") == 1)
	    {
	        GivePlayerWeapon(i, weapon, ammo);
	        SendClientMessage(i, COLOR_ADMIN, "You have been given an event weapon.");
	        SendClientMessage(playerid, COLOR_ADMIN, "You have given everyone at the event an event weapon.");
		}
	}
	return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)