All pastes #411275 Raw Edit

Unnamed

public cpp v1 · immutable
#411275 ·published 2007-03-26 22:23 UTC
rendered paste body
#include <a_samp>#include <xgas>new Filling[MAX_PLAYERS];main(){	print("\n----------------------------------");	print("  xGas_Example Script by Pixels^");	print("----------------------------------\n");}public OnGameModeInit(){	print("GameModeInit()");	SetGameModeText("xGas_Example");	xGas_SetAllGas(100);		SetTimer("Fuel",1000,1);	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);	return 1;}public OnPlayerRequestClass(playerid, classid){	SetPlayerPos(playerid, 1954.3783, 1343.1572, 15.3746);	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);	return 1;}public OnGameModeExit(){	return 1;}public OnPlayerConnect(playerid){	return 1;}public OnPlayerDisconnect(playerid){	return 1;}public OnPlayerSpawn(playerid){	for(new v=0; v<MAX_VEHICLE; v++) {	    xGas_SetGas(v,100);	}	return 1;}public OnPlayerDeath(playerid, killerid, reason){	return 1;}public OnVehicleSpawn(vehicleid){	return 1;}public OnVehicleDeath(vehicleid, killerid){	return 1;}public OnPlayerText(playerid){	return 1;}public OnPlayerCommandText(playerid, cmdtext[]){	new string[76];	new v = GetPlayerVehicleID(playerid);	if(strcmp(cmdtext, "/showgas", true) == 0) {		format(string,sizeof(string),"%d",xGas_ShowGas(v));		SendClientMessage(playerid,0xFFFFFFAA,string);		return 1;	}		if(strcmp(cmdtext, "/refuel", true) == 0) {	    if(!IsPlayerInAnyVehicle(playerid)) {			SendClientMessage(playerid,0xFF0000AA,"Not in any vehicle");			return 1;		}	    if(GetPlayerMoney(playerid) <= 99 && GetPlayerMoney(playerid) >= 1) {			SendClientMessage(playerid,0xFF0000AA,"Not enough money to refuel");			return 1;		}		Filling[playerid] = 1;		SendClientMessage(playerid,0xFFFFFFAA,"Filling vehicle");		return 1;	}	return 0;}public OnPlayerInfoChange(playerid){	return 1;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){	return 1;}public OnPlayerExitVehicle(playerid, vehicleid){	return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){	return 1;}public OnPlayerEnterCheckpoint(playerid){	return 1;}public OnPlayerLeaveCheckpoint(playerid){	return 1;}public Fuel() {	for(new i=0; i<MAX_PLAYERS; i++) {	    if(GetPlayerState(i) == 2) {	        new v = GetPlayerVehicleID(i);	        new string[76];			if(Filling[i] >= 1) {			    if(xGas_GetGas(v) >= 100) {			        SendClientMessage(i,0xFF0000AA,"Vehicle refueled");			        return Filling[i] = 0;			    }			    xGas_Fuel(v);				format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~w~Fuel %d",xGas_GetGas(v));				return GameTextForPlayer(i,string,2000,1);			}	        xGas_Deplete(v);			format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~w~Fuel %d",xGas_GetGas(v));			GameTextForPlayer(i,string,2000,1);	    }	}	return 1;}