SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command (/showthread.php?tid=187954)



Command - XxerykxX - 05.11.2010

Hello. Can someone tell me how to make a command that have 2 functions? I need command /vg. When you type /vg you turn on or off vehicle god can you tell me how do you make it? So like when you type /vg first time you turn on, second time you turn off etc.


Re: Command - KaleOtter - 05.11.2010

new VehicleGod[MAX_PLAYERS]; // on top of gamemode

if(strcmp(cmdtext, "/test", true)==0) // in onplayercommand
{
if(VehicleGod[playerid] == 0)
{
VehicleGod[playerid] = 1;
// Here you fuction set vehicle god on

}
else
{
VehicleGod[playerid] = 0;
// Here you fuction (set vehicle god off)

}

}


Re: Command - XxerykxX - 05.11.2010

Is that right?
Код:
if(strcmp(cmdtext, "/vg", true)==0)
{
        if(God[playerid] == 0)
        {
        God[playerid] = 1;
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Włączyłeś nieśmiertelność pojazdu. Wpisz /vg aby go wyłączyć.");
        }
        else
        {
        God[playerid] = 0;
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Wyłączyłeś nieśmiertelność pojazdu. Aby ją włączyć ponownie wpisz /vg.");
        }
		return 1;
}



Re: Command - blackwave - 06.11.2010

Код:
if(strcmp(cmdtext, "/vg", true)==0)
{
        if(God[playerid] == 0)
        {
        God[playerid] = 1;
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Włączyłeś nieśmiertelność pojazdu. Wpisz /vg aby go wyłączyć.");
        SetPlayerVehicleHealth(GetPlayerVehicleID(playerid) == 9999999);
        }
        else
        {
        God[playerid] = 0;
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Wyłączyłeś nieśmiertelność pojazdu. Aby ją włączyć ponownie wpisz /vg.");
                SetPlayerVehicleHealth(GetPlayerVehicleID(playerid) == 100);
        }
		return 1;
}