30.08.2012, 08:49
(
Последний раз редактировалось mickos; 30.08.2012 в 11:27.
)
Done
if(diloagid == dialogid +2){//why are you doing it as this? "dialogid+2"???? and use switch, they are much faster then if if(response){ switch(listitem){ case 0:{ //ls spawn } case 1:{ //sfls spawn } case 2:{ //lv spawn } }
public OnFilterScriptInit()
{
static a = 0,b = 10000,tt[2];
tt[0] = GetTickCount();
for(; a < b; ++a)
{
switch(a)
{
case 0..10000:
{
b = 100000000;
for(; 0 < b; --b)
{
}
}
}
}
tt[0] = GetTickCount() - tt[0];
a = 0,b = 10000;
tt[1] = GetTickCount();
for(; a < b; ++a)
{
if(a < 10000)
{
b = 100000000;
for(; 0 < b; --b)
{
}
}
}
tt[1] = GetTickCount() - tt[1];
printf(#%d - %d , tt[0],tt[1]);
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOGID:
{
if(response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Which player would you like to play as?", "Police\nDrug Dealer", "Select", "Cancel");
}
}
}
}
case DIALOGID+1:
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPlayerSkin(playerid, 61); //Police
SetPlayerColor(playerid, 0x6086D6FF);
new rand = random(sizeof(lsaRandomSpawns));
SetPlayerPos(playerid, lsaRandomSpawns[rand][0], lsaRandomSpawns[rand][1], lsaRandomSpawns[rand][2]);
SetPlayerFacingAngle(playerid,lsaRandomSpawns[rand][3]);
SetCameraBehindPlayer(playerid);
return ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Where would you like to spawn?", "Los Santos\nSan Fierro\nLas Venturas", "Select", "Cancel");
}
case 1:
{
SetPlayerSkin(playerid, 7); //Drug Dealer
SetPlayerColor(playerid, 0xD66060FF);
new rand = random(sizeof(sfaRandomSpawns));
SetPlayerPos(playerid, sfaRandomSpawns[rand][0], sfaRandomSpawns[rand][1], sfaRandomSpawns[rand][2]);
SetPlayerFacingAngle(playerid,sfaRandomSpawns[rand][3]);
SetCameraBehindPlayer(playerid);
return ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Where would you like to spawn?", "Los Santos\nSan Fierro\nLas Venturas", "Select", "Cancel");
}
}
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOGID:
{
if(response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Which player would you like to play as?", "Police\nDrug Dealer", "Select", "Cancel");
}
}
}
}
case DIALOGID+1:
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPlayerSkin(playerid, 61); //Police
SetPlayerColor(playerid, 0x6086D6FF);
return ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Where would you like to spawn?", "Los Santos\nSan Fierro\nLas Venturas", "Select", "Cancel");
}
case 1:
{
SetPlayerSkin(playerid, 7); //Drug Dealer
SetPlayerColor(playerid, 0xD66060FF);
return ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Where would you like to spawn?", "Los Santos\nSan Fierro\nLas Venturas", "Select", "Cancel");
}
}
}
}
case DIALOGID+2:
{
if(response)
{
switch(listitem)
{
case 0:
{
// here you put all stuff about LS.
}
case 1:
{
// here you put all stuff about SF.
}
case 2:
{
// here you put all stuff about LV.
}
}
}
}
}
return 1;
}