Errors Compiling
#1

Hey, I am trying to open a server with the mod 'LARP' and the /tazer command doesn't work, so I took it from another script, and changed it, but it cannot be complied because of the line:
if(Tazer[playerid] == 0)
The errors are:
error 017: undefined symbol "Tazer"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

The full /tazer script is:
pawn Код:
if(strcmp(cmd, "/tazer", true) ==0 || strcmp(cmd, "/ta", true) ==0)
    {
        if(gTeam[playerid] == 2 || IsACop(playerid))
        {
            new weapons[13][2];
            for (new i = 0; i < 13; i++)
            {
                GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
            }

            if(Tazer[playerid] == 0)
            {
                if(PlayerInfo[playerid][pTazerBullets] != 0)
                {
                    new ammo = weapons[2][1];
                    PreTazerAmmo[playerid] = ammo;
                    SafeGivePlayerWeapon(playerid, 23, PlayerInfo[playerid][pTazerBullets]);
                    Tazer[playerid] = 1;
                    AttachWeaponCorrectly(playerid, 24);
                    SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 500);
                    OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
                    format(string, sizeof(string), "* %s hostlers his Desert Deagle and Unhostlers his Tazer.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"* No charges in the tazer!");
                    return 1;
                }
            }
            else
            {
                new ammo = weapons[2][1];
                PlayerInfo[playerid][pTazerBullets] = ammo;
                SafeGivePlayerWeapon(playerid, 24, PreTazerAmmo[playerid]);
                AttachWeaponCorrectly(playerid, 23);
                Tazer[playerid] = 0;
                ClearAnimations(playerid);
                SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][pSilenSkill]);
                format(string, sizeof(string), "* %s hostlers his tazer and Unhostlers his Deagle.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
            }
        }
        return 1;
What to do?
Reply
#2

undefined symbol is only because , you didn't defined the string (also known as variable) before

I am not sure but try this
pawn Код:
if(strcmp(cmd, "/tazer", true) ==0 || strcmp(cmd, "/ta", true) ==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] == 2 || IsACop(playerid))
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Cannot use this while being in the Car!");
                    return 1;
                }
                new suspect = GetClosestPlayer(playerid);
                if(IsPlayerConnected(suspect))
                {
                    if(PlayerCuffed[suspect] > 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   Player already Cuffed!");
                        return 1;
                    }
                    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
                    {
                        if(gTeam[suspect] == 2)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   Cannot Tazer Cops / FBI!");
                            return 1;
                        }
                        if(IsPlayerInAnyVehicle(suspect))
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   Suspect is in a Car, get him out first!");
                            return 1;
                        }
                        GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new randt = random(4)+1;
                        if(randt == 1)
                        {
                            format(string, sizeof(string), "* %s shoots with his Tazer at %s, but missed.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            format(string, sizeof(string), "* You were Tazed by %s for 20 seconds.", sendername);
                            SendClientMessage(suspect, COLOR_WHITE, string);
                            format(string, sizeof(string), "* You Tazed %s for 20 seconds.", giveplayer);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* %s shoots with his Tazer at %s and tazed him.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            GameTextForPlayer(suspect, "~r~Tazed", 2500, 3);
                            TogglePlayerControllable(suspect, 0);
                            LoopingAnim(suspect, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                            PlayerCuffed[suspect] = 1;
                            PlayerCuffedTime[suspect] = 20;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   No-one near you!");
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop / FBI!");
            }
        }//not connected
        return 1;
    }
Reply
#3

This copilies, but this the orginal script which doesn't work.
/tazer doesn't give you the tazer weapon.
Reply
#4

Oh thats the problem ,

You copied /tazer cmd from somewhere else, so you need to define every thing in that script First



In original script shows it only taze anyone near you , its not scripted as a tazer weapon..
For making a tazer weapon I advise you to refer the following links


https://sampforum.blast.hk/showthread.php?tid=272548



https://sampforum.blast.hk/showthread.php?tid=194706
https://sampforum.blast.hk/showthread.php?tid=299634



Have Fun..
Reply
#5

Quote:
Originally Posted by Neo Karls
Посмотреть сообщение
Oh thats the problem ,

You copied /tazer cmd from somewhere else, so you need to define every thing in that script First



In original script shows it only taze anyone near you , its not scripted as a tazer weapon..
For making a tazer weapon I advise you to refer the following links


https://sampforum.blast.hk/showthread.php?tid=272548



https://sampforum.blast.hk/showthread.php?tid=194706
https://sampforum.blast.hk/showthread.php?tid=299634



Have Fun..
Ok, thanks, I will leave it as it is.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)