SA-MP Forums Archive
Zcmd Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Zcmd Problem (/showthread.php?tid=546388)



Zcmd Problem - Diti1 - 15.11.2014

Hey boys i am trying to create my own admin system but i cant do that because of Zcmd its not working on my pawno
Here its my problem

Код:
C:\Users\ardit_000\Desktop\BISHAT\filterscripts\test.pwn(305) : warning 203: symbol is never used: "kick"
C:\Users\ardit_000\Desktop\BISHAT\filterscripts\test.pwn(305) : warning 203: symbol is never used: "login"
C:\Users\ardit_000\Desktop\BISHAT\filterscripts\test.pwn(305) : warning 203: symbol is never used: "register"
C:\Users\ardit_000\Desktop\BISHAT\filterscripts\test.pwn(305) : warning 203: symbol is never used: "setlevel"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
and Here its my pawno script

Код HTML:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <SII>


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

enum PlayerInfo
{
	Logged,
	Level
}
new PInfo[MAX_PLAYERS][PlayerInfo];
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)
{
    new file[64],PlayerName[25];//Creating a variable where we can store the file path, and the variable to store the player's name.
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);//Storing the players name in the PlayerName variable.
    format(file,sizeof file,"Admin/%s.ini",PlayerName);//Storing the file path with the players name.
    if(!fexist(file))//Checking if the file exists
    {
        SendClientMessage(playerid,-4,"Your account its not registred! Please use /register <password> to register one");
    }
    else
    {
        SendClientMessage(playerid,-4,"Your account its already registred!Please Use /login <password> to login into your account");
    }
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    PInfo[playerid][Logged] = 0;
    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 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;
}
CMD:register(playerid,params[])
{
   if(PInfo[playerid] [Logged] == 1) return SendClientMessage(playerid,-4,"You are already logged in !");//checks if player its logged or not
   new password[23];//Creates a variable to store passowrds
   if(sscanf(params,"s[23]",password)) return SendClientMessage(playerid,-1,"USAGE:/Register <passowrd>");// this will check if player wrote something or no
   new file[64],PlayerName[24];// creates/stores player names
   GetPlayerName(playerid,PlayerName,sizeof PlayerName);
   format(file,sizeof file,"Admin/%s.ini",PlayerName);
   if(fexist(file)) return SendClientMessage(playerid,-4,"Somehow you're already registered!");//Checking if the player is already registered, again....
   INI_Open(file);//Opening the file with SII include (with this function, if the file is not created, it will automatically create the file.)
   INI_WriteString("Password",password);//Writing in the file the password the player has inputted.
   INI_WriteInt("Level",PInfo[playerid][Level]);//Writing in the file, the variable of the admin level.
   INI_Save();//After we write something to the file, we already have to use this to save the information in the player's file.
   INI_Close();//"Closing the file", that means that we're not using it anymore :P
   SendClientMessage(playerid,-1,"You have successfully registered!");
   PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
   }
CMD:login(playerid,params[])
{
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,-4,"You are already logged in!");//Checking if the player is logged in, if he is, it won't allow him to login
    new password[23],password2[23];//Creating a variable to store the password, and another one to store the password from the user's file.
    if(sscanf(params,"s[23]",password)) return SendClientMessage(playerid,-1,"USAGE: /login <password>");//Here we're checking if the player inputs any password, if not, it will return to him a message saying the proper usage.
    new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(!fexist(file)) return SendClientMessage(playerid,-4,"Please use /register");//Checking if the player is not registered, again....
    INI_Open(file);//Opening the file with SII include
    INI_ReadString(password2,"Password");
    if(strcmp(password,password2) != 0) return SendClientMessage(playerid,-4,"Wrong password!"),INI_Close();//Checking if he inputted the correct password, if not, retrieve him a message and closing the file;
    PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
    INI_Close();//"Closing the file", that means that we're not using it anymore :P
    SendClientMessage(playerid,-1,"You have been successfully logged in!");
    PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
    return 1;
}

CMD:kick(playerid, params[])
{
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,-4,"You need to be level 3 to kick players");//Checking if the player has admin level 3, if not it sends him a message.
    new id;//Creating a variable to store the selected id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /kick <id>");//Checking if the player has selected an id, other wise it sends him a message. We used the "u" specifier, because he can put a name or an id.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"That player is not connected!");//Checking if the selected user is connected or not.
    Kick(id);
    SendClientMessage(playerid,-1,"You have kicked the selected user!");
    return 1;
}
CMD:setlevel(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-4,"Only rcon admins can set admin levels!");//Checking if the player is rcon admin to set an admin level
    new id, level;//Creating the id variable to store the selected id and a level variable for the chosen admin level.
    if(sscanf(params[],"ui",id,level)) return SendClientMessage(playerid,-1,"USAGE: /setlevel <id> <level>");//Check if the player inputted a username or id and a admin level.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"That player is not connected!");//Checking if the selected user is connected or not.
    new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
    GetPlayerName(id,PlayerName,sizeof PlayerName);//Retrieving the selected id's name,
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(!fexist(file)) return SendClientMessage(playerid,-4,"That player is not registered");//Checking if the player is not registered
    INI_Open(file);//Opening the file with SII include
    INI_WriteInt("Level",level);//Writing the line "Level" the selected admin level.
    INI_Save();//Saving the file
    INI_Close();//Closing the file
    PInfo[id][Level] = level;
    SendClientMessage(playerid,-1,"You have changed the selected user's admin level");
    SendClientMessage(id,-1,"Your admin level has been changed");
    return 1;
}



Re : Zcmd Problem - Dutheil - 15.11.2014

Where do you include "sscanf2" and "YSI/y_ini" ?


Re: Zcmd Problem - Diti1 - 15.11.2014

i haven't inculded any of these but when i include sscanf2 it tells me already included i dont really know where it is i started a new pawno


Re : Zcmd Problem - Dutheil - 15.11.2014

Have you the latest version of zcmd and sscanf2 ?


Re: Zcmd Problem - Diti1 - 15.11.2014

Yes i just downloaded one now
but can you give me too maybe it will work


Re: Zcmd Problem - Diti1 - 15.11.2014

Please some one help me give me the last zcmd and sscanf2