SA-MP Forums Archive
parking system - 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: parking system (/showthread.php?tid=408035)



parking system - Stanford - 16.01.2013

hello i need a scripter that supports a parkmeter like if you do /parkmeter [Minutes] you can park your car near it, one dollar each minute, can anyone help me, I tried hard.. I couldn't get any result.


AW: parking system - IPrototypeI - 16.01.2013

That's easy but you have to think a little bit.
At first write down what dou you need
1. Command with parameter
2. A Timer which repeat every minute
3. You need a global 1d array for each player
4. if statement with IsPlayerInRangOfPoint

Know what do you want to use
1. Command (strcmp , YCMD , ZCMD ...)
2. Get the parameter (sscanf , strtok...)

Know How it should work now
1. Player use this command
2. get the value from the parameter as parktime
3. Timer should reduce the value from the player each minute

Then start with scripting your command


Re: parking system - Glad2BeHere - 16.01.2013

https://sampforum.blast.hk/showthread.php?tid=187229

I AM USING ZCMD
pawn Код:
CMD:parkmeter(playerid, params[])
{
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You are not in a vehicle");
   if(!IsPlayerInRangeOfParkMeter(playerid)) return SendClientMessage(playerid, -1, "You are not near a park meter");
   new minute;
   if(sscanf(params, "i", minute)) return SendClientMessage(playerid, -1, "USAGE: /parkmeter [minutes]");
   if(minute <= 0) return SendClientMessage(playerid, -1, "The minutes need to be more than 1");
   GivePlayerMoney(playerid, -minute);
   return 1;
}

stock IsPlayerInRangeOfParkMeter(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 2, 2227.3281,1655.5314,961.7531)) return 1;
    else if(IsPlayerInRangeOfPoint(playerid, 2, 2228.5593,1651.2610,961.7596)) return 1;
    return 0;
}
//put ur own cords and radius
from your explanation that is what i got


Re: parking system - Stanford - 17.01.2013

Glad2BeHere, can you define these symbols man


Re: parking system - RajatPawar - 17.01.2013

That's very basic coding Edmund, you need to brush up your knowledge here before trying out things like this, try basic tutorials given on the wiki. Anyways, CMD:command is the way to script with zcmd, you need to replace 'command' with your command. sscanf - ysi.wikia.com