Error please help
#1

I found a siren systen I'm putting on my server but I get an error.. here's my code


Код:
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];
Код:
dcmd_siren(playerid, params[])
{
        if(gTeam[playerid] = TEAM_COP)
        {
                new string[128], type;
                new VID = GetPlayerVehicleID(playerid);
                if(sscanf(params, "d", type))
                {
                        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
                        SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
                        return 1;
                }
                switch(type)
                {
                case 1:
                        {
                                if(Siren[VID] == 1)
                                {
                                        SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                                        return 1;
                                }
                                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                return 1;
                        }
                case 2:
                        {
                                if(Siren[VID] == 1)
                                {
                                        SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
                                        return 1;
                                }
                        Siren[VID] = 1;
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                        AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
                        format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                        return 1;
                        }
                case 3:
                        {
                                if(Siren[VID] == 0)
                                {
                                        SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
                                        return 1;
                                }
                                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s takes down the siren.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                return 1;
                        }
                default:
                        {
                                SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
                                SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
                        }
                }
        }
        else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
        return 1;
}
And my warning..
Код:
 warning 203: symbol is never used: "dcmd_siren"
I tried this public
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(siren,5,cmdtext);
    return 1;
}
but it gives me alot of erros too

Код:
error 021: symbol already defined: "OnPlayerCommandText"
 : warning 211: possibly unintended assignment
 : error 017: undefined symbol "SendClientMessageEx"
 : error 017: undefined symbol "SendClientMessageEx"
 : error 017: undefined symbol "SendClientMessageEx"
 : error 017: undefined symbol "ProxDetector"
 : error 017: undefined symbol "SendClientMessageEx"
: error 017: undefined symbol "ProxDetector"
 : error 017: undefined symbol "SendClientMessageEx"
 : error 017: undefined symbol "ProxDetector"
 : error 017: undefined symbol "SendClientMessageEx"
 : error 017: undefined symbol "SendClientMessageEx"
 : error 017: undefined symbol "SendClientMessageEx"
Reply
#2

Remove "Ex" from SendClientMessage

Add this somewhere in your code

pawn Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
//==============================================================================
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
                {
                    SendClientMessage(i, col1, string);
                }
                else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
                {
                    SendClientMessage(i, col2, string);
                }
                else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
                {
                    SendClientMessage(i, col3, string);
                }
                else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
                {
                    SendClientMessage(i, col4, string);
                }
                else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
                {
                    SendClientMessage(i, col5, string);
                }
            }
            else
            {
                SendClientMessage(i, col1, string);
            }
        }
    }
    return 1;
}
And, CTRL +f and search on OnPlayerCommandText, it seems like you have two, remove one.
Reply
#3

Thanks, most erros fixed, I get one warning and one error now

I got two yea, these are the two


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(siren,5,cmdtext);
    return 1;
}
and

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[128];
	SpamStrings[playerid] +=2;
    if(SpamStrings[playerid] >= MAX_SPAM)
	{
	    format(string,sizeof(string),"Please do not spam in %s. Please wait before typing again.",sabbv);
	    SendClientMessage(playerid, COLOR_ERROR, string);
	    return 1;
    }
But how can I make it diffrent? I need both of them

my warning / error is

Код:
warning 211: possibly unintended assignment
error 021: symbol already defined: "OnPlayerCommandText"
Reply
#4

Got the warning removed

Still got the error, please help me, I have no idea how to change one of them over so its not two of "OnPlayerCommandText"
Reply
#5

No one knows :/?
Reply
#6

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[128];
        dcmd(siren,5,cmdtext);
    SpamStrings[playerid] +=2;
        if(SpamStrings[playerid] >= MAX_SPAM)
    {
        format(string,sizeof(string),"Please do not spam in %s. Please wait before typing again.",sabbv);
        SendClientMessage(playerid, COLOR_ERROR, string);
        return 1;
       }

}
remove the above one you posted!
Reply
#7

but then I got no anti spam :/?
Reply
#8

Use the one I posted and remove

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(siren,5,cmdtext);
    return 1;
}
Reply
#9

Edited : next page on this tropic
Reply
#10

Whats your current code now?

P.S. use [pawn ] and [/pawn]
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)