PaintSpray
#1

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]--;
						}
					}
		        }
		}
Reply
#2

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;
}
Reply
#3

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

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

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

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

Closed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)