Some Idea's i wanna add
#1

Hello,

I have some idea's i wanna add to my server, but i dont know how to script them.

My idea's are:

1. Car god mode on and off command. (DONE!)
(/vgod)

Код:
Add 

pawn Код:
#pragma tabsize 0
on the top of your gamemode!

Top of script:

pawn Код:
forward vgod();new vgoded[MAX_PLAYERS];
OnGameModeInit/OnFilterScriptInit:

pawn Код:
SetTimer("vgod", 1000, 1);
Then anywhere under:

pawn Код:
public vgod(){    for(new i=0; i < MAX_PLAYERS; i++)    {      if(IsPlayerConnected(i))      {            if(vgoded[i])            {                SetVehicleHealth(GetPlayerVehicleID(i),1000.0);            }        }    }    return 1;}
Command:

pawn Код:
if (strcmp("/vgod", cmdtext, true) == 0)    {      if(vgoded[playerid] == 0)      {        vgoded[playerid] = 1;        }        else        {        vgoded[playerid] = 0;      }    return 1;    }
/Vgod will turn it on or off depending if its on or off.
2. Anti Fall Of Bike on and off command. (DONE!)
(/afon and /afoff)

Код:
pawn Код:
#define Driver 0#define Passanger 2new Act[MAX_PLAYERS];new InCar[MAX_PLAYERS];new WhatCar[MAX_PLAYERS];
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid){    InCar[playerid] = 0;    return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){    if(Act[playerid] == 1)    {        if(oldstate == PLAYER_STATE_DRIVER)        {            if(newstate == PLAYER_STATE_ONFOOT)            {                if(InCar[playerid] == 1)                {                    PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);                }            }        }        if(oldstate == PLAYER_STATE_PASSENGER)        {            if(newstate == PLAYER_STATE_ONFOOT)            {                if(InCar[playerid] == 1)                {                    PutPlayerInVehicle(playerid, WhatCar[playerid], Passanger);                }            }        }        if(oldstate == PLAYER_STATE_ONFOOT)        {            if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)            {                InCar[playerid] = 1;                WhatCar[playerid] = GetPlayerVehicleID(playerid);            }        }    }    return 1;}public OnPlayerCommandText(playerid, cmdtext[]){    if (strcmp("/afon", cmdtext, true) == 0)    {        Act[playerid] = 1;        GameTextForPlayer(playerid, "~w~Anti fall off bike is now ~g~on", 5000, 5);        return 1;    }    if (strcmp("/afoff", cmdtext, true) == 0)    {        GameTextForPlayer(playerid, "~w~Anti fall off bike is now ~r~off", 5000, 5);        Act[playerid] = 0;        return 1;    }    return 0;}
3. Spawn Vehicle auto remove.
(I want when sombody spawn a vehicle with /vmenu, /giveme or /v, and he dont use the vehicle any more, that the vehicle will auto removed from server, becouse this spawned vehicles makes a big mass in game.)


I hope somebody can help me.

Greetings,

DlennartD
Reply
#2

1. You can set the Vehicles Health to max.
Reply
#3

Quote:
Originally Posted by Serbish
1. You can set the Vehicles Health to max.
I think he wants it so that they automatically repair. Just use a timer and call SetVehicleHealth
Reply
#4

I know how to make a car god mode, but i want to give players the choise to put it on or off for the vehicle they are driving.
Reply
#5

Quote:
Originally Posted by [KMA
DlennartD ]
I know how to make a car god mode, but i want to give players the choise to put it on or off for the vehicle they are driving.
Ok, then use a command.
Example:

Код:
if(strcmp(cmdtext, "/cargodon", true) == 0)
{
SetTimer for VehicleHealth
}
Код:
if(strcmp(cmdtext, "/cargodon", true) == 0)
{
KillTimer for VehicleHealth
}
Reply
#6

Then just define the vehicleid
pawn Код:
if(strcmp(cmdtext,"/cargodon",true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
new vehicleid = GetPlayerVehicleID(playerid);
SetTimerEx("CarGodMode",1000,"i",vehicleid);
return 1;
}

public CarGodMode(vehicleid)
{
SetVehicleHealth(vehicleid,5000);
return 1;
}
Or the alternative to make it for the player and not the vehicle he types it in

pawn Код:
if(strcmp(cmdtext,"/cargodon",true) == 0)
{
SetTimerEx("CarGodMode",1000,"i",playerid);
return 1;
}

public CarGodMode(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid,5000);
return 1;
}
Reply
#7

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by JaTochNietDan
Quote:
Originally Posted by Serbish
1. You can set the Vehicles Health to max.
I think he wants it so that they automatically repair. Just use a timer and call SetVehicleHealth
Why use a timer while he can set the health to 999999999 and I doubt he'll ever each 1000.
Car could flip over, which instantly makes the vehicle to 100 percent damage
Reply
#8

Try this then

Код:
if(strcmp(cmdtext,"/cargodon",true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle to use godmode.");
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid,99999);
SendClientMessage(playerid, COLOR_GREEN, "Vehicles godmode turned on.");

return 1;
}
Код:
if(strcmp(cmdtext,"/cargodoff",true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle to turn godmode off.");
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid,1000);
SendClientMessage(playerid, COLOR_RED, "Vehicles godmode turned off.");
return 1;
}
Reply
#9

Top of script:

pawn Код:
forward vgod();
new vgoded[MAX_PLAYERS];
OnGameModeInit/OnFilterScriptInit:

pawn Код:
SetTimer("vgod", 1000, 1);
Then anywhere under:

pawn Код:
public vgod()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
      {
            if(vgoded[i])
            {
                SetVehicleHealth(GetPlayerVehicleID(i),1000.0);
            }
        }
    }
    return 1;
}
Command:

pawn Код:
if (strcmp("/vgod", cmdtext, true) == 0)
    {
      if(vgoded[playerid] == 0)
      {
        vgoded[playerid] = 1;
        }
        else
        {
        vgoded[playerid] = 0;
      }
    return 1;
    }
/Vgod will turn it on or off depending if its on or off.
Reply
#10

Quote:
Originally Posted by Mikep
... Scripting ... :P
It seems verry nice, but i get one warning:

C:\Documents and Settings\Administrator\Bureaublad\GTA\CAS\gamemode s\extreme2.pwn(2200) : warning 217: loose indentation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)