SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/08/2015, 11:38 AM   #1
RotAway
Little Clucker
 
Join Date: Apr 2015
Location: Greece
Posts: 21
Reputation: 0
Question Got Problem with a GameTextForPlayer

Code:
if(TransportDriver[playerid] < MAX_PLAYERS)
		{
			new string[128];
			TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
			format(string, sizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
			GameTextForPlayer(playerid, string, 5000, 3);
			format(string, sizeof(string), "~w~Passenger left the taxi.~n~~g~Earned $%d",TransportCost[playerid]);
			GameTextForPlayer(TransportDriver[playerid], string, 5000, 3);
			GivePlayerCash(playerid, -TransportCost[playerid]);

			new ip[32], ipex[32];
			GetPlayerIp(playerid, ip, sizeof(ip));
			GetPlayerIp(TransportDriver[playerid], ipex, sizeof(ipex));
			TaxiWarn[playerid][TransportDriver[playerid]] += TransportCost[playerid];
			if(TaxiWarn[playerid][TransportDriver[playerid]] >= 10000)
			{
				format(string, sizeof(string), "%s (IP:%s) has taxied %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(TransportDriver[playerid]), ipex, TaxiWarn[playerid][TransportDriver[playerid]]);
				//Log("logs/pay.log", string);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
			TransportTime[TransportDriver[playerid]] = 0;
			TransportCost[TransportDriver[playerid]] = 0;
			TransportCost[playerid] = 0;
			TransportTime[playerid] = 0;
			TransportDriver[playerid] = 999;
		}
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
	}
My problem is when i am login in it shows this message "The ride cost 0$" also when i am exiting from a vehicle it appears that message again. Any solution ? (This bug is for everyone it's not only for me)
RotAway is offline   Reply With Quote
Old 04/08/2015, 12:01 PM   #2
SpikY_
High-roller
 
SpikY_'s Avatar
 
Join Date: Jul 2014
Location: xSF
Posts: 1,273
Reputation: 128
Default Re: Got Problem with a GameTextForPlayer

Show me your OnPlayerExitVehicle..

Regards,
- SpikY_
__________________
SpikY_ is offline   Reply With Quote
Old 04/08/2015, 12:02 PM   #3
RotAway
Little Clucker
 
Join Date: Apr 2015
Location: Greece
Posts: 21
Reputation: 0
Default Re: Got Problem with a GameTextForPlayer

Quote:
Originally Posted by SpikY_ View Post
Show me your OnPlayerExitVehicle..

Regards,
- SpikY_
Code:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(GetPlayerState(playerid) == 1)
		return 1;
		
	// Seatbelt Check
	switch(Seatbelt[playerid])
	{
	    case 1:
	    {
			new string[128];
	        if(IsABike(vehicleid))
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your helmet.");
				format(string, sizeof(string), "* %s reaches for their helmet, and takes it off.", GetPlayerNameEx(playerid));
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "You have taken off your seatbelt.");
				format(string, sizeof(string), "* %s reaches for their seatbelt, and unbuckles it.", GetPlayerNameEx(playerid));
			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  			Seatbelt[playerid] = 0;
	    }
	}

	if(GetPVarInt(playerid, "rccam") == 1)
	{
		DestroyVehicle(GetPVarInt(playerid, "rcveh"));
		VehicleRadioStation[GetPVarInt(playerid, "rcveh")] = 0;
	    SetPlayerPos(playerid, GetPVarFloat(playerid, "rcX"), GetPVarFloat(playerid, "rcY"), GetPVarFloat(playerid, "rcZ"));
		DeletePVar(playerid, "rccam");
	    KillTimer(GetPVarInt(playerid, "rccamtimer"));
	}
	return 1;
}
RotAway is offline   Reply With Quote
Old 04/08/2015, 01:00 PM   #4
RotAway
Little Clucker
 
Join Date: Apr 2015
Location: Greece
Posts: 21
Reputation: 0
Default Re: Got Problem with a GameTextForPlayer

Code:
	// Timer for Engine
	SetTimer("CheckVehHealth", 2000, true); ( under OnGameModeInit)


Code:
forward CheckVehHealth();
public CheckVehHealth()
{
    new Float: f_vHealth;

    for(new x = 1, t = GetVehiclePoolSize(); x <= t; x++)
    {
        if(!GetVehicleModel(x)) continue;

        GetVehicleHealth(x,  f_vHealth);

        if( f_vHealth < 350.0)
        {
            SetVehicleHealth(x, 350.0);
			/* Check vehicle's health status here: https://wiki.sa-mp.com/wiki/VehicleHealth */
        }
    }
    return 1;
}
When i added those codes i got this bug with The Ride cost 0$
+1 rep for helping me !
RotAway is offline   Reply With Quote
Old 04/08/2015, 01:23 PM   #5
RotAway
Little Clucker
 
Join Date: Apr 2015
Location: Greece
Posts: 21
Reputation: 0
Default Re: Got Problem with a GameTextForPlayer

Anyone ? bump !
RotAway is offline   Reply With Quote
Old 13/08/2017, 10:05 AM   #6
Greaper
Big Clucker
 
Greaper's Avatar
 
Join Date: Dec 2013
Location: Philippines
Posts: 106
Reputation: 8
Default Re: Got Problem with a GameTextForPlayer

LOL

Code:
if(TransportDriver[playerid] < 999)
		{
			new string[128];
			TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
			format(string, sizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
			GameTextForPlayer(playerid, string, 5000, 3);
			format(string, sizeof(string), "~w~Passenger left the taxi.~n~~g~Earned $%d",TransportCost[playerid]);
			GameTextForPlayer(TransportDriver[playerid], string, 5000, 3);
			GivePlayerCash(playerid, -TransportCost[playerid]);

			new ip[32], ipex[32];
			GetPlayerIp(playerid, ip, sizeof(ip));
			GetPlayerIp(TransportDriver[playerid], ipex, sizeof(ipex));
			TaxiWarn[playerid][TransportDriver[playerid]] += TransportCost[playerid];
			if(TaxiWarn[playerid][TransportDriver[playerid]] >= 10000)
			{
				format(string, sizeof(string), "%s (IP:%s) has taxied %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(TransportDriver[playerid]), ipex, TaxiWarn[playerid][TransportDriver[playerid]]);
				//Log("logs/pay.log", string);
				ABroadCast(COLOR_YELLOW, string, 1);
			}
			TransportTime[TransportDriver[playerid]] = 0;
			TransportCost[TransportDriver[playerid]] = 0;
			TransportCost[playerid] = 0;
			TransportTime[playerid] = 0;
			TransportDriver[playerid] = 999;
		}
		TelePos[playerid][0] = 0.0;
		TelePos[playerid][1] = 0.0;
	}
Greaper is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] GameTextForPlayer SukMathcuck Português/Portuguese 2 22/10/2014 05:26 PM
GameTextForPlayer Fernado Samuel Scripting Help 2 16/11/2012 05:11 AM
GameTextForPlayer Socan Scripting Help 5 12/11/2012 09:09 AM
Problem with GameTextForPlayer New Ilyass Help Archive 4 24/01/2011 01:37 PM
GameTextForPlayer problem [SOLVED] chaosnz Help Archive 2 11/05/2010 10:25 PM


All times are GMT. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.