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



PaintSpray - anonimus22222 - 17.10.2015

If I type the command [/repairveh], put all the server in Paint
Код HTML:
	if(strcmp(cmd, "/repairveh", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
		    if(PlayerToPoint(5.0, playerid, -1903.1232,275.5934,41.0391))
		        {
		        for(new i = 0; i < MAX_PLAYERS; i++)
	{
					new vehicle;
					vehicle = GetPlayerVehicleID(i);
	     			DisableRemoteVehicleCollisions(i, 1);
			        SetTimer("RepairVeh", 4500, false);
					SetVehiclePos(vehicle, -1904.4136,283.7806,40.7740);
					if(PlayerData[i][pPbiskey] == 0)
						{
							GameTextForPlayer(i, "~w~Nici o taxa pentru seful.", 5000, 3);
							return 1;
						}
					if (GetPlayerCash(i) <  SBizzData[13][sbEntranceCost])
						{
							SendClientMessage(i, COLOR_GRAD2, "Nu ai atatia bani!");
							return 1;
						}
						GivePlayerCash(i,-SBizzData[13][sbEntranceCost]);
						SBizzData[13][sbTill] += SBizzData[13][sbEntranceCost];
						ExtortionSBiz(13, SBizzData[13][sbEntranceCost]);
						SBizzData[13][sbProducts]--;
						}
					}
		        }
		}



Re: PaintSpray - alexanderjb918 - 17.10.2015

Include zcmd this code should work

CMD:repair(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You are not in a vehicle!");
if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, -1, "You are not in the driver seat!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, -1, "Your vehicle has been sucessfully repaired!");
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
return 1;
}


Re: PaintSpray - anonimus22222 - 17.10.2015

That's the right answer? ) I do not think. Someone else?


Re: PaintSpray - AndySedeyn - 17.10.2015

The reason why everyone in the server is put into a Pay'N'Spray is because you loop through all the players and put each and everyone in it. Only want the player that uses the command to go to a Pay'N'Spray? Remove the for-loop.

Secondly, why are you checking whether or not the player using the command is connected to the server? Surely enough in order for a player to use the command, they have to be connected to the server. The check is therefore redundant.


Re: PaintSpray - anonimus22222 - 17.10.2015

Only one other comment. Is a profitable Paint'Spray sBizz.


Re: PaintSpray - AndySedeyn - 17.10.2015

Your reply is not relevant to what I replied. Remove the for-loop and change the loop body so that it works for the player that uses the command (playerid). I'm not going to spoon-feed you the code (someone else probably will). I've given you understandable instructions to solve the issue.


Re: PaintSpray - anonimus22222 - 17.10.2015

Closed.