SA-MP Forums Archive
Max the command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Max the command (/showthread.php?tid=303235)



[Solved]Max the command - Min - 12.12.2011

Hello guys, how to maximum this command after the players has used it 4 times?
This is the script:

Код:
#include <a_samp>

#define ORANGE 0xFF5F11FF
#define RED 0xFF0000AA


public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/fix", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
		    if(GetPlayerMoney(playerid) >= 300)
		   {
 	          	SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
 	          	RepairVehicle(GetPlayerVehicleID(playerid));
 	          	GivePlayerMoney(playerid,-2500);
            	PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
            	SendClientMessage(playerid, ORANGE, "You have fixed your vehicles for $2500.");
   			}
   			else
			{
			SendClientMessage(playerid,RED,"You don't have enough money to use this command.");
			}
		}
		else
		{
	 	new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid, x, y, z);
		CreateVehicle(468, x, y, z, 82.2873, 0, 1, 60);
 		GivePlayerMoney(playerid,-4000);
 		SendClientMessage(playerid, ORANGE, "You have bought your new vehicle for $4000.");
		}
		return 1;
	}
	return 0;
}