open.mp forum
simplificar checkpoints - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: Other languages (https://forum.open.mp/forumdisplay.php?fid=23)
--- Forum: Spanish/Espa?ol (https://forum.open.mp/forumdisplay.php?fid=24)
---- Forum: Programaci?n (https://forum.open.mp/forumdisplay.php?fid=51)
---- Thread: simplificar checkpoints (/showthread.php?tid=614)



simplificar checkpoints - zzztgtzzz - 2019-05-30

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;

? ? ? ? ? ?}



RE: simplificar checkpoints - Juance - 2019-05-30

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.


RE: simplificar checkpoints - Markski - 2019-05-30

Un switch statement seria la principal manera de simplificar ese c?digo.



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