Earning money for cars they 'drop' - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Earning money for cars they 'drop' (
/showthread.php?tid=422287)
Earning money for cars they 'drop' -
xXRealLegitXx - 13.03.2013
So, I made a command that makes a checkpoint, if you are in a vehicle, and when you go into the checkpoint, again with a car, you will earn a random amount of money.
This is the command:
Код:
CMD:dropcar(playerid, params[])
{
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.5544, 5.0);
}
if (IsPlayerInCheckpoint(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
GivePlayerMoney(playerid, random(1000) + 657);
SetVehicleToRespawn(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You dopped a car! You must now wait 15 minutes before doing this command again.");
}
return 1;
}
If someone could fix this command for me, and give me an example on how to have different random ammounts of money for a different car.
Re: Earning money for cars they 'drop' -
vladi866 - 13.03.2013
PHP код:
CMD:dropcar(playerid, params[])
{
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.5544, 5.0);
}
if (IsPlayerInCheckpoint(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
GivePlayerMoney(playerid, random(1000) + 657);
SetVehicleToRespawn(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You dopped a car! You must now wait 15 minutes before doing this command again.");
}
return 1;
}
in the first one it checks that if u r in a car and if u r it will say you are not in a vehicle.
I was suppose to be !IsPlayerInAnyVehicle.
Re: Earning money for cars they 'drop' -
Mystique - 13.03.2013
Use this function to check for different car model ids. By that you can make different randoms for different vehicles in a simple way.
https://sampwiki.blast.hk/wiki/GetVehicleModel
Re: Earning money for cars they 'drop' -
xXRealLegitXx - 13.03.2013
Quote:
Originally Posted by vladi866
PHP код:
CMD:dropcar(playerid, params[])
{
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.5544, 5.0);
}
if (IsPlayerInCheckpoint(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
GivePlayerMoney(playerid, random(1000) + 657);
SetVehicleToRespawn(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You dopped a car! You must now wait 15 minutes before doing this command again.");
}
return 1;
}
in the first one it checks that if u r in a car and if u r it will say you are not in a vehicle.
I was suppose to be !IsPlayerInAnyVehicle.
|
Fixes the client message issue, but the checkpoint still doesnt respond.
Re: Earning money for cars they 'drop' -
xXRealLegitXx - 13.03.2013
Quote:
Originally Posted by Mystique
|
Thanks, but could you give an example and explain to me how it works? I am not very good with PAWN