SA-MP Forums Archive
Create cp on command? - 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: Create cp on command? (/showthread.php?tid=401838)



Create cp on command? - NicholasA - 24.12.2012

Hey guys i got this command that should make a command and when you enter it, it should destroy itself and give some money?
How do i do this?
pawn Код:
COMMAND:startmech(playerid, params[]) // work at mechanic and receive $180
{
  if(!IsPlayerInRangeOfPoint(playerid, 30.0,2451.0056,-2118.1301,13.5469))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");
  if(IsPlayerInVehicle(playerid, 525)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a mechanics vehicle! ))");
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Deliver the tires to the checkpoint and receive your paycheck! ))");
  return 1;
}



Re: Create cp on command? - Konstantinos - 24.12.2012

On the command create a variable and set it to true and the checkpoint (SetPlayerRaceCheckpoint)
When he enters the checkpoint (OnPlayerEnterRaceCheckpoint) check if the variable you created before is true and do the following:
DisablePlayerRaceCheckpoint and set that variable to false. Don't forget to reset them in OnPlayerConnect.


Re: Create cp on command? - DaRk_RaiN - 24.12.2012

Hmm if you want to use a checkpoint it better be with streamer, i'll give you a code which uses Pick ups
Put this on the top of your script
pawn Код:
new TiresPick;
The command
pawn Код:
COMMAND:startmech(playerid, params[]) // work at mechanic and receive $180
{
  if(!IsPlayerInRangeOfPoint(playerid, 30.0,2451.0056,-2118.1301,13.5469))return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic]You are not at the mechanic HQ! ))");
  if(IsPlayerInVehicle(playerid, 525)) return SendClientMessage(playerid, 0xE0313AFF, "(( [Mechanic] You are not in a mechanics vehicle! ))");
  SendClientMessage(playerid, 0x3524C9FF, "(( [Mechanic] Deliver the tires to the checkpoint and receive your paycheck! ))");
    TiresPick = CreatePickup(1274, 0, 2451.0056,-2118.1301,13.5469);//the pickup
  return 1;
}
When player picks up the pickup
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == TiresPick)
    {
    GivePlayerMoney(playerid,3000);//the cash.
    DestroyPickup(Tirespick);
    }
return 1;
}



Re: Create cp on command? - Jack_Ryder - 24.12.2012

pawn Код:
I can't see any problem with that but check maybe you have unfinde symbol



Re: Create cp on command? - Konstantinos - 24.12.2012

Quote:
Originally Posted by Jack_Ryder
Посмотреть сообщение
pawn Код:
I can't see any problem with that but check maybe you have unfinde symbol
What?

He is asking how to do it with checkpoints, nothing is wrong with his code until now.