28.11.2008, 21:57
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)
2. Anti Fall Of Bike on and off command. (DONE!)
(/afon and /afoff)
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
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)
Код:
Addon the top of your gamemode!pawn Код:#pragma tabsize 0
Top of script:
OnGameModeInit/OnFilterScriptInit:pawn Код:forward vgod();new vgoded[MAX_PLAYERS];
Then anywhere under:pawn Код:SetTimer("vgod", 1000, 1);
Command:pawn Код:public vgod(){ for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(vgoded[i]) { SetVehicleHealth(GetPlayerVehicleID(i),1000.0); } } } return 1;}
/Vgod will turn it on or off depending if its on or off.pawn Код:if (strcmp("/vgod", cmdtext, true) == 0) { if(vgoded[playerid] == 0) { vgoded[playerid] = 1; } else { vgoded[playerid] = 0; } return 1; }
(/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;}
(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