Problem with a race start line.
#1

Hi, so i am creating a race system and now i have a problem with a start line, so there are 5 slots and the server checks if each of them are empty or not, but the problem is that the server doesn't do anything, when i write the command. So heres the script:

Код:
COMMAND:plenktynes(playerid, params[])
{
  new masinosid = GetPlayerVehicleID(playerid);
  new zaidejofailas[100], lenk[100], vardas[MAX_PLAYER_NAME];
  GetPlayerName(playerid, vardas, sizeof(vardas));
  format(zaidejofailas, sizeof(zaidejofailas), "FR/Saskaitos/%s.ini",vardas);
  format(lenk, sizeof(lenk), "FR/lenktynes/dalyviai.ini");
  if(IsPlayerInAnyVehicle(playerid) == 1)
  {
     if(dini_Int(zaidejofailas, "Smasina") != -1) DestroyVehicle(dini_Int(zaidejofailas, "Smasina"));
     SetVehicleToRespawn(masinosid);
     if(dini_Int(lenk, "Uzimta1") != 0) Check if Slot1 is free
     {
        new i = GetPlayerInterior(playerid);
     	new v = CreateVehicle(560,-2010.6499,387.8221,34.6782,1.4096, -1, -1, 0);
     	LinkVehicleToInterior(v, i);
     	dini_IntSet(zaidejofailas, "Smasina", v);
     	dini_IntSet(lenk, "Uzimta1", 1);
     	PutPlayerInVehicle(playerid, v, 0);
     	lenktynes[playerid] = 1;
     	SetPlayerRaceCheckpoint(playerid,0,-2004.8567,605.0294,34.6769,
     	-1810.2356,605.7285,34.6789,20);
     }
     else if(dini_Int(lenk, "Uzimta2") != 0) Check if Slot2 is free
     {
        new i = GetPlayerInterior(playerid);
     	new v = CreateVehicle(560,-2008.0226,387.9178,34.6406,359.7637, -1, -1, 0);
     	LinkVehicleToInterior(v, i);
     	dini_IntSet(zaidejofailas, "Smasina", v);
     	dini_IntSet(lenk, "Uzimta2", 1);
     	PutPlayerInVehicle(playerid, v, 0);
     	lenktynes[playerid] = 1;
     	SetPlayerRaceCheckpoint(playerid,0,-2004.8567,605.0294,34.6769,
     	-1810.2356,605.7285,34.6789,20);
     }
     else if(dini_Int(lenk, "Uzimta3") != 0) Check if Slot3 is free
     {
        new i = GetPlayerInterior(playerid);
     	new v = CreateVehicle(560,-2005.2972,387.9866,34.6407,358.4459, -1, -1, 0);
     	LinkVehicleToInterior(v, i);
     	dini_IntSet(zaidejofailas, "Smasina", v);
     	dini_IntSet(lenk, "Uzimta3", 1);
     	PutPlayerInVehicle(playerid, v, 0);
     	lenktynes[playerid] = 1;
     	SetPlayerRaceCheckpoint(playerid,0,-2004.8567,605.0294,34.6769,
     	-1810.2356,605.7285,34.6789,20);
     }
     else if(dini_Int(lenk, "Uzimta4") != 0) Check if Slot4 is free
     {
        new i = GetPlayerInterior(playerid);
     	new v = CreateVehicle(560,-2002.6100,387.7462,34.6406,357.6168, -1, -1, 0);
     	LinkVehicleToInterior(v, i);
     	dini_IntSet(zaidejofailas, "Smasina", v);
     	dini_IntSet(lenk, "Uzimta4", 1);
     	PutPlayerInVehicle(playerid, v, 0);
     	lenktynes[playerid] = 1;
     	SetPlayerRaceCheckpoint(playerid,0,-2004.8567,605.0294,34.6769,
     	-1810.2356,605.7285,34.6789,20);
     }
     else if(dini_Int(lenk, "Uzimta5") != 0)Check if Slot5 is free
     {
        new i = GetPlayerInterior(playerid);
     	new v = CreateVehicle(560,-1999.9409,387.6945,34.6406,358.6654, -1, -1, 0);
     	LinkVehicleToInterior(v, i);
     	dini_IntSet(zaidejofailas, "Smasina", v);
     	dini_IntSet(lenk, "Uzimta5", 1);
     	PutPlayerInVehicle(playerid, v, 0);
     	lenktynes[playerid] = 1;
     	SetPlayerRaceCheckpoint(playerid,0,-2004.8567,605.0294,34.6769,
     	-1810.2356,605.7285,34.6789,20);
     }
  }
  return 1;
}
And i have a question about this line:

Код:
format(lenk, sizeof(lenk), "FR/lenktynes/dalyviai.ini");
Do i scan the file correctly?
Reply
#2

try going
pawn Код:
new rp;
rp = dini_Int(lenk, "Uzimta1");
printf("slot = %d",rp);
if(rp != 0){
//check
{
and see if that makes any diffrence and what the value is
Reply
#3

It doesn't work, but know it shows in server log that slots = 0. Yesterday i tried playing with other numbers and it worked with 1, and i dont know whats wrong with 0...

EDIT: Fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)