• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simplificar checkpoints
#1
Buenas! quer?a saber como se puede hacer para reducir los checkpoints, en vez de tener todas estas lineas, hacerlo mas reducido.



Code:
? ?if(GetPVarInt(playerid,"TEST_CP") == 0)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 1);

? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4048.2869,-3002.8801,1351.9772, 5);

? ? ? ? ? ? ? ?return 1;

? ? ? ? ? ?}

? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 1)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 2);

? ? ? ? ? ? ? ?PuntoTest[playerid] ;

? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4035.4558,-3038.5496,1351.9779, 5);

? ? ? ? ? ? ? ?return 1;

? ? ? ? ? ?}

? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 2)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 3);

? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4039.2056,-3066.4712,1351.9767, 5);

? ? ? ? ? ? ? ?return 1;

? ? ? ? ? ?}

? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 3)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 4);

? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, -4017.9539,-3052.5557,1351.9771, 5);

? ? ? ? ? ? ? ?return 1;

? ? ? ? ? ?}

? ? ? ? ? ?if(GetPVarInt(playerid,"TEST_CP") == 4)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?SetPVarInt(playerid, "TEST_CP", 0);

? ? ? ? ? ? ? ? SetPlayerCheckpoint(playerid, ?-4048.2869,-3002.8801,1351.9772, 5);

? ? ? ? ? ? ? ?return 1;

? ? ? ? ? ?}
  Reply
#2
Podes hacer una funci?n donde ah? tengas la l?gica de tu sistema, y tambi?n podr?as incluir a la funci?n el operador switch.
  Reply
#3
Un switch statement seria la principal manera de simplificar ese c?digo.



https://www.burgershot.gg/showthread.php?tid=114
  Reply


Forum Jump: