SA-MP Forums Archive
Can someone get this 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: Can someone get this command (/showthread.php?tid=160723)



Can someone get this command - willsuckformoney - 17.07.2010

Can someone get this command to work i tried enough with switching deleting adding and cant get it to work, someone give me some help please

pawn Код:
#include <a_samp>

new GodCarMode[MAX_PLAYERS];
#define INFINITY (Float:1000000)
#define COLOR_MAGENTA 0xFF00FFFF

public OnPlayerConnect(playerid)
{
    GodCarMode[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/godcar", true) == 0)
{
    new playerState = GetPlayerState(playerid);
    if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER)
    {
        if(IsPlayerAdmin(playerid))
        {
            if(GodCarMode[playerid] == 0)  
            {
                SendClientMessage(playerid, COLOR_MAGENTA, "GOD CAR MODE ON");
                SetVehicleHealth(playerid, INFINITY);
                GodCarMode[playerid] = 1;
            }
            else if(GodCarMode[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_MAGENTA, "GOD CAR MODE OFF");
                SetVehicleHealth(playerid, 1000);
                GodCarMode[playerid] = 0;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_MAGENTA, "You are not an admin!");
        }  
    }
    else
    {
        SendClientMessage(playerid, COLOR_MAGENTA, "You are not in any vehicle");
    }
    return 1;
}
return 0;
}



Re: Can someone get this command - DiddyBop - 17.07.2010

Try this


pawn Код:
#include <a_samp>

//#define INFINITY (Float:1000000)  Lol infinity. lolol
#define COLOR_MAGENTA 0xFF00FFFF

new GodCarMode[MAX_PLAYERS];

public OnFilterScriptInit()
{
    SetTimer("GodCar", 2000, 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    GodCarMode[playerid] = 0;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

if(strcmp(cmdtext, "/godcar", true) == 0)
{
    new playerState = GetPlayerState(playerid);
    if (playerState == PLAYER_STATE_PASSENGER || playerState == PLAYER_STATE_DRIVER)
    {
        if(IsPlayerAdmin(playerid))
        {
            if(GodCarMode[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_MAGENTA, "GOD CAR MODE ON");
                GodCarMode[playerid] = 1;
            }
            else if(GodCarMode[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_MAGENTA, "GOD CAR MODE OFF");
                SetVehicleHealth(playerid, 1000);
                GodCarMode[playerid] = 0;
            }
            }
            else
            {
                SendClientMessage(playerid, COLOR_MAGENTA, "You are not an admin!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_MAGENTA, "You are not in any vehicle");
        }
    return 1;
    }
return 0;
}

forward GodCar();
public GodCar()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && GodCarMode[i] == 1 && IsPlayerInAnyVehicle(i))
        {
            SetVehicleHealth(GetPlayerVehicleID(i),10000);
        }
    }
}
(I did not test, just made and compiled)

If doesnt work, post back.


Re: Can someone get this command - willsuckformoney - 17.07.2010

lol hello LiLGuNnA will test when get back xD moo!

EDIT:Works anyway to change timer to make it repair faster?


Re: Can someone get this command - DiddyBop - 17.07.2010

k. happy masterbations.