Max cars
#1

Hi i have command /gut and when type that then teleport my car to my location but how can i make when in that location is 30 cars cant tele
Reply
#2

Code?
Reply
#3

Код:
if (strcmp(cmdtext, "/race", true) == 0) {
	if (IsPlayerConnected(playerid)) {
	if (PlayerToPoint(3.0, playerid,-2036.5963,302.3366,34.9292)) {
	if (IsPlayerInAnyVehicle(playerid)) {
	SetVehiclePos(GetPlayerVehicleID(playerid), -2084.3301,-216.8675,34.6121);
	SetPlayerPos(playerid, -2090.3301,-216.8675,34.6121);
	}//POSITIONS DONE
	SendClientMessage(playerid, 0xFF66FFAA, "Tu ....! ");
Reply
#4

indent alert

pawn Код:
if (strcmp(cmdtext, "/race", true) == 0)
{
  if (IsPlayerConnected(playerid))
  {
    if (PlayerToPoint(3.0, playerid,-2036.5963,302.3366,34.9292))
    {
      if (IsPlayerInAnyVehicle(playerid))
      {
        SetVehiclePos(GetPlayerVehicleID(playerid), -2084.3301,-216.8675,34.6121);
        SetPlayerPos(playerid, -2090.3301,-216.8675,34.6121);
      }//POSITIONS DONE
      SendClientMessage(playerid, 0xFF66FFAA, "Tu ....! ");
    }
  }
}
there was a bunch of brackets missing here
Reply
#5

Код:
if (IsPlayerConnected(playerid)) 
  {
Why? How a player that isn't connected can type a command?
Reply
#6

that cmd works but i need to max cars in setvehiclepos is 30 cars
Reply
#7

pawn Код:
if (strcmp(cmdtext, "/race", true) == 0)
{
  if (!PlayerToPoint(3.0, playerid,-2036.5963,302.3366,34.9292))
    return SendClientMessage(playerid, 0xFF66FFAA, "You're not near enough");

  if (!IsPlayerInAnyVehicle(playerid))
    return SendClientMessage(playerid, 0xFF66FFAA, "You're not in a car");
 
  // loop through all vehicles
  new vehiclecount;
  for (new v = 0; v < MAX_VEHICLES; v++)
  {
    if (VehicleToPoint(v, 'radius', 'x', 'y', 'z'))
      vehiclecount++;
  }

  if (vehiclecount >= 30)
    return SendClientMessage(playerid, 0xFF66FFAA, "Too many vehicles there already");

  SetVehiclePos(GetPlayerVehicleID(playerid), -2084.3301,-216.8675,34.6121);
  SetPlayerPos(playerid, -2090.3301,-216.8675,34.6121);

  return 1;
}

// some where else
stock VehicleToPoint(vehicleid, Float:radi, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
    tempposx = (oldposx - x);
    tempposy = (oldposy - y);
    tempposz = (oldposz - z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        return 1;
   
    return 0;
}
Reply
#8

I have 4 errors C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : error 017: undefined symbol "VehicleToPoint"
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : error 017: undefined symbol "adius"
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : warning 215: expression has no effect
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : error 001: expected token: ";", but found "-integer value-"
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : fatal error 107: too many error messages on one line
Reply
#9

Quote:
Originally Posted by WoozieRocks
Код:
if (IsPlayerConnected(playerid)) 
  {
Why? How a player that isn't connected can type a command?
True, I use it only for the ReturnedUser (if the player isn't connected it says : Invalid player id.)
Reply
#10

And when i insert VehicleToPoint i haave this error
Код:
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : error 027: invalid character constant
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : error 027: invalid character constant
C:\Documents and Settings\Martins\Desktop\SA-MP serveris\gamemodes\Fizzy.pwn(1424) : fatal error 107: too many error messages on one line
1424 line is: if (VehicleToPoint(v, '3.0',-2084.3301,-216.8675,34.6121))
but PlayerToPoint i have that: if (!PlayerToPoint(3.0, playerid,-2036.5963,302.3366,34.9292))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)