13.12.2014, 21:40
Why do us need to make for loop?
its enum + array..
like:
why we need that for loop?
When we need do it?
thanx..
its enum + array..
like:
PHP код:
enum TELE_DATA
{
TELE_CMD[16],
Float:TELE_POS_X,
Float:TELE_POS_Y,
Float:TELE_POS_Z,
TELE_MESSAGE[32],
TELE_WEAPON,
TELE_AMMO,
TELE_MONEY,
TELE_INTERIOR,
TELE_VIRTUAL_WORLD
}
PHP код:
new pTele[][TELE_DATA] =
{
{"/Ramp", 1859.3246, -1381.7324, 13.5625, "!бшелйн дбайн мжйшъ дшофд", 0, 0, 0, 0, 0}
};
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
for(new i, j = sizeof(pTele); i < j; i++)
{
if(strcmp(cmdtext, pTele[i][TELE_CMD], true))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), pTele[i][TELE_POS_X], pTele[i][TELE_POS_Y], pTele[i][TELE_POS_Z]);
}
else SetPlayerPos(playerid, pTele[i][TELE_POS_X], pTele[i][TELE_POS_Y], pTele[i][TELE_POS_Z]);
GivePlayerWeapon(playerid, pTele[i][TELE_WEAPON], pTele[i][TELE_AMMO]);
GivePlayerMoney(playerid, pTele[i][TELE_MONEY]);
SetPlayerInterior(playerid, pTele[i][TELE_INTERIOR]);
SetPlayerVirtualWorld(playerid, pTele[i][TELE_VIRTUAL_WORLD]);
SendClientMessage(playerid, -1, pTele[i][TELE_MESSAGE]);
}
}
return 1;
}
When we need do it?
thanx..