Admin duty error
#1

Hello, I am a new-er scripter, and I was wondering why I get this error.. please help :-], Thanks in advance.

(57234) : error 021: symbol already defined: "OnPlayerCommandText"



Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/aduty", cmdtext, true, 10) == 0)
	{
	    if(PlayerInfo[playerid][pAdmin] >= 2)
	    {
	        SendClientMessage(playerid,0xFF0000DB,"ERROR: You are not an Admin!");
	    }
	    else
	    {
	        adminduty[playerid] = 1;
	        SetPlayerSkin(playerid,217);
	        SendClientMessage(playerid,0x00FF0068,"You are now on duty.");
		}
		return 1;
	}

	if (strcmp("/adutyoff", cmdtext, true, 10) == 0)
	{
	    if(adminduty[playerid] == 0)
	    {
	        SendClientMessage(playerid,0xFF0000DB,"ERROR: You are not on duty!");
	    }
	    else
	    {
	        adminduty[playerid] = 0;
	        SpawnPlayer(playerid);
	        SendClientMessage(playerid,0xFFB600BC,"You are now off duty.");
		}
		return 1;
	}

}
Reply
#2

find "OnPlayerCommandText" in your gamemode, probably you duplicated this public.

--
rep+ if I helped
Reply
#3

Since you are new here is something to start off with.

Код:
CMD:aduty(playerid)
{
    if(playerVariables[playerid][pAdmin] == 0 || !IsPlayerAdmin(playerid)) return  SendClientMessage(playerid,0xFF0000DB,"ERROR: You are not an Admin!");
	adminduty[playerid] = 1;
	SetPlayerSkin(playerid,217);
	SendClientMessage(playerid,0x00FF0068,"You are now on duty.");
    return 1;
}
Use ZCMD and sscanf. strcmp is way out of dated
Reply
#4

Quote:
Originally Posted by Forever Alone
Посмотреть сообщение
Since you are new here is something to start off with.

Код:
CMD:aduty(playerid)
{
    if(playerVariables[playerid][pAdmin] == 0 || !IsPlayerAdmin(playerid)) return  SendClientMessage(playerid,0xFF0000DB,"ERROR: You are not an Admin!");
	adminduty[playerid] = 1;
	SetPlayerSkin(playerid,217);
	SendClientMessage(playerid,0x00FF0068,"You are now on duty.");
    return 1;
}
Use ZCMD and sscanf. strcmp is way out of dated
I would except I started developing it in strcmp, a bit ago, is there a easy way to convert it?

One more question, how I have been learning to script is basicly by looking at other game modes, trying to replicate how they do it... since like *******/wiki tutorials seem to only talk about a specific thing.

Is this a good way of learning? if not, how can I learn?
Reply
#5

Quote:
Originally Posted by Zachlive
Посмотреть сообщение
I would except I started developing it in strcmp, a bit ago, is there a easy way to convert it?

One more question, how I have been learning to script is basicly by looking at other game modes, trying to replicate how they do it... since like *******/wiki tutorials seem to only talk about a specific thing.

Is this a good way of learning? if not, how can I learn?
Theres no easy way to convert, except command by command. I can do it for you if you would like.
Reply
#6

Quote:
Originally Posted by C00K13M0N$73R
Посмотреть сообщение
Theres no easy way to convert, except command by command. I can do it for you if you would like.
Well this script is pre-developed, like I said im trying to learn how to script by reading others, trying to learn from it (Witch I am not quite sure if thats working so far), there are like 50,000 lines of code, I would feel terrible if I just "Sat on my ass" and you converted all of those.

P.S. I am yet able to create a command from scratch :/
Reply
#7

Quote:
Originally Posted by Zachlive
Посмотреть сообщение
Well this script is pre-developed, like I said im trying to learn how to script by reading others, trying to learn from it (Witch I am not quite sure if thats working so far), there are like 50,000 lines of code, I would feel terrible if I just "Sat on my ass" and you converted all of those.

P.S. I am yet able to create a command from scratch :/
pawn Код:
if (strcmp("/aduty", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 2)
        {
            SendClientMessage(playerid,0xFF0000DB,"ERROR: You are not an Admin!");
        }
        else
        {
            adminduty[playerid] = 1;
            SetPlayerSkin(playerid,217);
            SendClientMessage(playerid,0x00FF0068,"You are now on duty.");
        }
        return 1;
    }
We get rid of OnPlayerCommandText

pawn Код:
CMD:aduty(playerid,params[])//We dont use a /
{
        if(PlayerInfo[playerid][pAdmin] >= 2)
        {
            SendClientMessage(playerid,0xFF0000DB,"ERROR: You are not an Admin!");
        }
        else
        {
            adminduty[playerid] = 1;
            SetPlayerSkin(playerid,217);
            SendClientMessage(playerid,0x00FF0068,"You are now on duty.");
        }
return 1;
}
Reply
#8

Looking at other gamemodes and mixing them together is a best way to start in my opinion. Since you are not planning to use zcmd( ) I modified new.pwn for you to learn. Go to http://pastebin.com/dwbABZ5r and see by yourself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)