Earning money for cars they 'drop'
#1

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.
Reply
#2

PHP код:
CMD:dropcar(playeridparams[])
{
    {
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"You are not in a vehicle!");
    
SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.55445.0);
    }
    
    if (
IsPlayerInCheckpoint(playerid))
    {
    if(
IsPlayerInAnyVehicle(playerid))
    
GivePlayerMoney(playeridrandom(1000) + 657);
    
SetVehicleToRespawn(playerid);
    
SendClientMessage(playeridCOLOR_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.
Reply
#3

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
Reply
#4

Quote:
Originally Posted by vladi866
Посмотреть сообщение
PHP код:
CMD:dropcar(playeridparams[])
{
    {
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"You are not in a vehicle!");
    
SetPlayerCheckpoint(playerid, -1697.0311,-92.7514,3.55445.0);
    }
    
    if (
IsPlayerInCheckpoint(playerid))
    {
    if(
IsPlayerInAnyVehicle(playerid))
    
GivePlayerMoney(playeridrandom(1000) + 657);
    
SetVehicleToRespawn(playerid);
    
SendClientMessage(playeridCOLOR_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.
Reply
#5

Quote:
Originally Posted by Mystique
Посмотреть сообщение
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
Thanks, but could you give an example and explain to me how it works? I am not very good with PAWN
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)