A bit of help for giving/taking money in a filterscript
#1

Hi,this filterscript is very old and it is a basic taxi script but it does not take or give any money like its supposed to.
It does everything else like the textdraws and chat messages though.

#define BAJADA_DE_BANDERA 200
#define PRECIO_FICHA 100

new OnTaxiAsPassenger[MAX_PLAYERS];
new CostoDelViaje[MAX_PLAYERS];
new contador[MAX_PLAYERS];
new playerInMiniMission[MAX_PLAYERS];
new avisado[MAX_PLAYERS];
new caidadefichaTimer;
new cantidadPasajeros;

forward terminarMission(playerid);
forward caidadeficha();

public OnFilterScriptInit()
{
print("\n TAXI Filter Script v1.0 Loading...\n**********************\n (Zeruel_Angel)\n");
for (new i=0;i<MAX_PLAYERS;i++)
{
playerInMiniMission[i]=-1;
avisado[i]=-1;
OnTaxiAsPassenger[i]=-1;
}
caidadefichaTimer=-1;
cantidadPasajeros=0;
SetTimer("caidadeficha",30000,1);
print("TAXI Filter Script fully Loaded\n**********************************\n\n");
}

public OnFilterScriptExit()
{
print("\n**********************\n*TAXI Script UnLoaded*\n**********************\n");
return 1;
}
//------------------------------------------------------------------------------------------------------
public terminarMission(playerid)
{
new msg[255];
format(msg,sizeof(msg),"~r~TAXI ~w~MiniMission cancelled~n~ You carried ~r~%d~w~ pasengers.",contador[playerid]);
GameTextForPlayer(playerid,msg,3000,4);
playerInMiniMission[playerid]=-1;
avisado[playerid]=-1;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(msg,sizeof(msg),"***ATENTION: %s Is NOT a TAXI DRIVER anymore***",name);
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
for (new i=0;i<MAX_PLAYERS;i++)
{
if (playerid!=i)
{
SendClientMessage(i,0xFFFF00AA," ");
SendClientMessage(i,0xFFFF00AA,msg);
}
}
for (new i=0;i<MAX_PLAYERS;i++)
{
if (OnTaxiAsPassenger[i]==playerid)
{
new taxista = playerid;
OnTaxiAsPassenger[i]=-1;
new viaje=CostoDelViaje[i];
format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
GameTextForPlayer(i,msg,3000,4);
format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
GameTextForPlayer(taxista,msg,3000,4);
GivePlayerMoney(i,-viaje);
GivePlayerMoney(taxista,viaje);
cantidadPasajeros--;
if (cantidadPasajeros==0)
{
KillTimer(caidadefichaTimer);
}
}
}
contador[playerid]=0;
return 1;
}
//------------------------------------------------------------------------------------------------------
public caidadeficha()
{
for (new i=0;i<MAX_PLAYERS;i++)
{
CostoDelViaje[i]=CostoDelViaje[i]+PRECIO_FICHA;
}
}
//------------------------------------------------------------------------------------------------------
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new msg[255];
if (newstate==PLAYER_STATE_DRIVER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
if (avisado[playerid]==-1)
{
GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start the ~n~~r~TAXI~w~ Minimissions.",3000,5);
}
else
{
KillTimer(avisado[playerid]);
avisado[playerid]=-1;
}
}
}
if (newstate==PLAYER_STATE_ONFOOT)
{
if ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
{
GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~TAXI",3000,4);
avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playeri d);
}
if (OnTaxiAsPassenger[playerid]!=-1)
{
new taxista = OnTaxiAsPassenger[playerid];
new name[MAX_PLAYER_NAME];
GetPlayerName(taxista,name,MAX_PLAYER_NAME);
OnTaxiAsPassenger[playerid]=-1;
new viaje = CostoDelViaje[playerid];
format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
GameTextForPlayer(playerid,msg,3000,4);
format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
GameTextForPlayer(taxista,msg,3000,4);
GivePlayerMoney(playerid,-viaje);
GivePlayerMoney(taxista,viaje);
cantidadPasajeros--;
if (cantidadPasajeros==0)
{
KillTimer(caidadefichaTimer);
}
}
}
if (newstate==PLAYER_STATE_PASSENGER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
new i=0;
while (i<MAX_PLAYERS)
{
if ((playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
{
if (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i,name,MAX_PLAYER_NAME);
contador[i]++;
format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~TAXI~w~",name);
GameTextForPlayer(playerid,msg,3000,4);
format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
GameTextForPlayer(playerid,msg,3000,4);
OnTaxiAsPassenger[playerid]=i;
CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
if (cantidadPasajeros==0)
{
caidadefichaTimer=SetTimer("caidadeficha",30000,1) ;
}
cantidadPasajeros++;
i=MAX_PLAYERS;
}
}
i++;
}
}
}
return 1;
}
//------------------------------------------------------------------------------------------------------
MissionIni(playerid)
{
playerInMiniMission[playerid]=1;
GameTextForPlayer(playerid,"~r~TAXI ~w~MiniMision ~w~iniciada",3000,4);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
new msg[255];
format(msg,sizeof(msg),"***ATENTION: %s is now a TAXI DRIVER***",name);
for (new i=0;i<MAX_PLAYERS;i++)
{
if (playerid!=i)
{
SendClientMessage(i,0xFFFF00AA," ");
SendClientMessage(i,0xFFFF00AA,msg);
}
}
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_SUBMISSION)&&(IsPlayerInAnyVehicle( playerid))&&(GetPlayerState(playerid)==PLAYER_STAT E_DRIVER))
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
if (playerInMiniMission[playerid]<0)
{
MissionIni(playerid);
}
else
{
terminarMission(playerid);
}
}
}
}
//------------------------------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid)
{
if (playerInMiniMission[playerid]>0)
{
terminarMission(playerid);
}
OnTaxiAsPassenger[playerid]=-1;
return 1;
}
Reply
#2

Pastebin it.
Reply
#3

ok. also note it isnt made by me,its a very old script. http://pastebin.com/f76a2a194 Also when i used it i edited the money and thats it. It compiled fine and everything. I had it as i think $20 and $50,as default at every 30seconds is pure madness.
Reply
#4

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)