replace tazer
#1

Hello, I am making a roleplay server and I'm currently scripting a tazer.
However, when I withdraw a tazer it will replace the current gun(pistol) with a sdpistol. When I holster it, I planned to make it so it would give the tazer back, however I only get weapon 0 back.

This is my code:

pawn Код:
CMD:tazer(playerid, params[])
{
    new replace;
    if(tazer[playerid] == 0)
    {
        replace = PlayerInfo[playerid][pGuns][2];
        GivePlayerValidWeapon(playerid, 23, 9999);
        tazer[playerid] = 1;
        new string[56];
        format(string, sizeof(string), "* %s unholsters his tazer.", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
    }
    if(tazer[playerid] == 1)
    {
        tazer[playerid] = 0;
        new string[56];
        GivePlayerValidWeapon(playerid, replace, 6000);
        format(string, sizeof(string), "* %s holsters his tazer. (debug %i)", GetPlayerNameEx(playerid), replace);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
    }
    return 1;
}
Reply
#2

Try this code:

pawn Код:
CMD:tazer(playerid, params[])
{
    if(tazer[playerid] == 0)
    {
        GivePlayerValidWeapon(playerid, 23, 9999);
        tazer[playerid] = 1;
        new string[56];
        format(string, sizeof(string), "* %s unholsters his tazer.", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
    }
    if(tazer[playerid] == 1)
    {
        tazer[playerid] = 0;
        new string[56];
        GivePlayerValidWeapon(playerid, 22, 6000);
        format(string, sizeof(string), "* %s holsters his tazer. ", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by rBcollo
Посмотреть сообщение
Try this code:

pawn Код:
CMD:tazer(playerid, params[])
{
    if(tazer[playerid] == 0)
    {
        GivePlayerValidWeapon(playerid, 23, 9999);
        tazer[playerid] = 1;
        new string[56];
        format(string, sizeof(string), "* %s unholsters his tazer.", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
    }
    if(tazer[playerid] == 1)
    {
        tazer[playerid] = 0;
        new string[56];
        GivePlayerValidWeapon(playerid, 22, 6000);
        format(string, sizeof(string), "* %s holsters his tazer. ", GetPlayerNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE);
        return 1;
    }
    return 1;
}
This wont help at all, because 22 is Colt 45, and it'd suck if I replace my Deagle with a tazer and get a colt 45 in return when you holster it. All I am askin is what is wrong with my code.
Reply
#4

solved it myself.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)