SA-MP Forums Archive
/tazer command - 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: /tazer command (/showthread.php?tid=447981)



/tazer command - TranquiliZed - 02.07.2013

I put this in....

pawn Код:
CMD:tazer(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LEO.");
    if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command while being in a vehicle.");
    if(!Tazer[playerid])
    {
        Tazer[playerid] = 1;
        format(string, sizeof(string), "* %s takes out their tazer from their holster and loads it.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        if(PlayerInfo[playerid][pWeapon][2] == 24) //3616
        {
            ReplaceTazer[playerid] = 1;
            GetPlayerWeaponData(playerid, 2, OldGun[playerid], OldAmmo[playerid]);
            SendClientMessage(playerid, COLOR_WHITE, "Your desert eagle will be given back when you holster your tazer.");
        }
        GunsBeingRemoved[playerid] = 1;
        RemoveDodWeapon(playerid, 24);
        GunsBeingRemoved[playerid] = 1;
        GiveDodWeapon(playerid, 23, 500);
        GunsBeingRemoved[playerid] = 1;
    }
    else
    {
        Tazer[playerid] = 0;
        RemoveDodWeapon(playerid, 23);
        format(string, sizeof(string), "* %s unloads their tazer and puts it back to their holster.", RPN(playerid));
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        if(ReplaceTazer[playerid])
        {

            ReplaceTazer[playerid] = 0;
            GunsBeingRemoved[playerid] = 1;
            GiveDodWeapon(playerid, OldGun[playerid], OldAmmo[playerid]);
            GunsBeingRemoved[playerid] = 1;
            OldGun[playerid] = 0;
            OldAmmo[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "You have recieved your desert eagle back as you've holstered your tazer.");
        }
    }
    return 1;
And I get this....

Код:
hrp.pwn(3616) : error 001: expected token: ")", but found "["
hrp.pwn(3616) : error 029: invalid expression, assumed zero
hrp.pwn(3616) : warning 215: expression has no effect
hrp.pwn(3616) : error 001: expected token: ";", but found "]"
hrp.pwn(3616) : fatal error 107: too many error messages on one line



Re: /tazer command - GoldAngel - 02.07.2013

HMM..What's the line 3616?


Re: /tazer command - TranquiliZed - 02.07.2013

Edited


Re: /tazer command - JimmyCh - 02.07.2013

PHP код:
CMD:tazer(playeridparams[])
{
    new 
string[128];
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(!
IsACop(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not an LEO.");
    if(!
PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playeridCOLOR_GREY"You are not on duty.");
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_GREY"You can't use this command while being in a vehicle.");
    if(!
Tazer[playerid])
    {
        
Tazer[playerid] = 1;
        
format(stringsizeof(string), "* %s takes out their tazer from their holster and loads it."RPN(playerid));
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
        if(
PlayerInfo[playerid][pWeapon][2] == 24//3616
        
{
            
ReplaceTazer[playerid] = 1;
            
GetPlayerWeaponData(playerid2OldGun[playerid], OldAmmo[playerid]);
            
SendClientMessage(playeridCOLOR_WHITE"Your desert eagle will be given back when you holster your tazer.");
        }
        
GunsBeingRemoved[playerid] = 1;
        
RemoveDodWeapon(playerid24);
        
GunsBeingRemoved[playerid] = 1;
        
GiveDodWeapon(playerid23500);
        
GunsBeingRemoved[playerid] = 1;
    }
    else
    {
        
Tazer[playerid] = 0;
        
RemoveDodWeapon(playerid23);
        
format(stringsizeof(string), "* %s unloads their tazer and puts it back to their holster."RPN(playerid));
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
        if(
ReplaceTazer[playerid])
        {
            
ReplaceTazer[playerid] = 0;
            
GunsBeingRemoved[playerid] = 1;
            
GiveDodWeapon(playeridOldGun[playerid], OldAmmo[playerid]);
            
GunsBeingRemoved[playerid] = 1;
            
OldGun[playerid] = 0;
            
OldAmmo[playerid] = 0;
            
SendClientMessage(playeridCOLOR_WHITE"You have recieved your desert eagle back as you've holstered your tazer.");
        }
    }
    return 
1;

This should work, but tell us what's on line 3616?