OnPlayerEnterVehicle and ServerSided -
PepsiCola23 - 06.07.2015
Hello guys today i have 2 problems that i want to solve.
1. This is what i have at public OnPlayerEnterVehicle
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new car = gLastCar[playerid];
if(IsPlayerConnected(playerid))
{
if (gGas[playerid] == 0)
{
gGas[playerid] = 1;
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~p~Fuel Info on", 5000, 5);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
}
if(Gas[car] < 100) { Gas[car] = 100; }
}
{
SendClientMessage(playerid,0x00FF80FF,"Te rugam sa iti pui centura folosind /centura pentru un drum mai bun!");
}
// HERE IS THE PROBLEM
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 423)
{
SendClientMessage(playerid, COLOR_RED, "{6EF29C}Scrie /ice pentru a incepe sa distribui inghetata ! ");
}
return 1;
}
The problem is that when someone enters a vehicle with model 423,the message is not send.Nothing happens..
how can i fix this?
2.I tried to make my money server-sided based,i tried some includes,some tutorials and no one worked.The compiler crash or..when it compiles,the server won-t start or the money does not work.
Can you give me an up to date include or giving me some tips?
Thanks in advance.
Re: OnPlayerEnterVehicle and ServerSided -
JaydenJason - 06.07.2015
If you want server sided money you should create another item in your player data enum called eg; "playerCash", and lets say you use GivePlayerMoney(playerid, -500); you could make a function that's like this
Код:
GivePlayerMoneyEx(playerid, amount)
{
if(amount > 0) return pData[playerid][playerCash] + amount;
else return pData[playerid][playerCash] - amount;
}
Код:
GetPlayerMoneyEx(playerid, amount)
{
return pData[playerid][playerCash];
}
Then you could overlap the money thingy with a text draw and add show it there, or you could use GivePlayerMoney every now and then to update it incase of a hacker that changes it, like this:
Код:
GivePlayerMoney(playerid, pData[playerid][playerCash]);
I hope you get it, and with the vehicle,
Taken from samp wiki:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 411) // 411 is the Infernus model
{
SendClientMessage(playerid, 0xFFFFFFFF, "Nice Infernus!");
}
return 1;
}
The OnPlayerEnterVehicle has the "vehicleid" parameter on it already, no need for GetPlayerVehicleID, try using
Код:
if(GetVehicleModel(vehicleid) == 423)
{
SendClientMessage(playerid, COLOR_RED, "{6EF29C}Scrie /ice pentru a incepe sa distribui inghetata ! ");
}
Re: OnPlayerEnterVehicle and ServerSided -
PepsiCola23 - 06.07.2015
The one with onplayerentervehicle..still not working.
And the server sided,i did the same thing as you said,everything compiles but it does not work..is there an include or tutorial?
Re: OnPlayerEnterVehicle and ServerSided -
PepsiCola23 - 07.07.2015
UP....
Re: OnPlayerEnterVehicle and ServerSided -
PepsiCola23 - 07.07.2015
No one knows?