25.05.2010, 20:00
eu tava a oulhar para outra linha... tens razгo...
new Stats[MAX_PLAYERS];
new Float:Checkpoints[17][3]= {
{2021.9279,851.2713,6.4387},
{1806.2888,851.1154,10.3762},
{1597.7745,850.9503,6.4374},
{1315.8704,886.0849,6.5154},
{1227.3850,1170.5470,6.5219},
{1228.7192,1804.4149,6.4378},
{1229.5260,2301.2026,6.4387},
{1447.5416,2452.2988,6.4377},
{1849.4731,2497.6997,6.5153},
{2287.5569,2607.9063,6.4585},
{2609.7202,2514.3423,5.8201},
{2706.6592,2158.3931,6.4492},
{2705.5173,1674.4374,6.4448},
{2706.8931,1278.5399,6.4373},
{2624.1135,932.2136,6.4433},
{2312.5583,854.1749,6.4375},
{2049.3154,853.4050,6.4387}
};
if(strcmp(cmdtext, "/partida", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
SetPlayerRaceCheckpoint(i, 0, Checkpoints[1][0], Checkpoints[1][1], Checkpoints[1][2], Checkpoints[2][0], Checkpoints[2][1], Checkpoints[2][2], 10);
Stats[i] = 1;
return 1;
}
}
}
else
{
SendClientMessage(playerid, 0x456EAF67, "Apenas Para Admins");
}
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
switch(Stats[playerid])
{
case 0:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[0][0], Checkpoints[0][1], Checkpoints[0][2], Checkpoints[1][0], Checkpoints[1][1], Checkpoints[1][2], 10);
Stats[i] = 0;
return 1;
}
case 1:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[1][0], Checkpoints[1][1], Checkpoints[1][2], Checkpoints[2][0], Checkpoints[2][1], Checkpoints[2][2], 10);
Stats[i] = 1;
return 1;
}
case 2:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[2][0], Checkpoints[2][1], Checkpoints[2][2], Checkpoints[3][0], Checkpoints[3][1], Checkpoints[3][2], 10);
Stats[i] = 2;
return 1;
}
case 3:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[3][0], Checkpoints[3][1], Checkpoints[3][2], Checkpoints[4][0], Checkpoints[4][1], Checkpoints[4][2], 10);
Stats[i] = 3;
return 1;
}
case 4:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[4][0], Checkpoints[4][1], Checkpoints[4][2], Checkpoints[4][0], Checkpoints[4][1], Checkpoints[4][2], 10);
Stats[i] = 4;
return 1;
}
case 5:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[5][0], Checkpoints[5][1], Checkpoints[5][2], Checkpoints[5][0], Checkpoints[5][1], Checkpoints[5][2], 10);
Stats[i] = 5;
return 1;
}
case 6:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[6][0], Checkpoints[6][1], Checkpoints[6][2], Checkpoints[6][0], Checkpoints[6][1], Checkpoints[6][2], 10);
Stats[i] = 6;
return 1;
}
case 7:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[7][0], Checkpoints[7][1], Checkpoints[7][2], Checkpoints[7][0], Checkpoints[7][1], Checkpoints[7][2], 10);
Stats[i] = 7;
return 1;
}
case 8:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[8][0], Checkpoints[8][1], Checkpoints[8][2], Checkpoints[8][0], Checkpoints[8][1], Checkpoints[8][2], 10);
Stats[i] = 8;
return 1;
}
case 9:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[9][0], Checkpoints[9][1], Checkpoints[9][2], Checkpoints[9][0], Checkpoints[9][1], Checkpoints[9][2], 10);
Stats[i] = 9;
return 1;
}
case 10:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[10][0], Checkpoints[10][1], Checkpoints[10][2], Checkpoints[10][0], Checkpoints[10][1], Checkpoints[10][2], 10);
Stats[i] = 10;
return 1;
}
case 11:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[11][0], Checkpoints[11][1], Checkpoints[11][2], Checkpoints[11][0], Checkpoints[11][1], Checkpoints[11][2], 10);
Stats[i] = 11;
return 1;
}
case 12:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[12][0], Checkpoints[12][1], Checkpoints[12][2], Checkpoints[12][0], Checkpoints[12][1], Checkpoints[12][2], 10);
Stats[i] = 12;
return 1;
}
case 13:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[13][0], Checkpoints[13][1], Checkpoints[13][2], Checkpoints[13][0], Checkpoints[13][1], Checkpoints[13][2], 10);
Stats[i] = 13;
return 1;
}
case 14:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[14][0], Checkpoints[14][1], Checkpoints[14][2], Checkpoints[14][0], Checkpoints[14][1], Checkpoints[14][2], 10);
Stats[i] = 14;
return 1;
}
case 15:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[15][0], Checkpoints[15][1], Checkpoints[15][2], Checkpoints[15][0], Checkpoints[15][1], Checkpoints[15][2], 10);
Stats[i] = 15;
return 1;
}
case 17:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 1, Checkpoints[16][0], Checkpoints[16][1], Checkpoints[16][2], Checkpoints[16][0], Checkpoints[16][1], Checkpoints[16][0], 10);
Stats[i] = 15;
return 1;
}
case 16:
{
DisablePlayerRaceCheckpoint(playerid);
GameTextForPlayer(playerid, "Voce ganhou a corrida!!|voce ganhou $10000", 3000, 1);
GivePlayerMoney(playerid, 10000);
return 1;
}
}
}
}
return 0;
}//17
#include <a_samp>
//-----------------------------------DM CORRIDA MALUCA COMANDO /CORRIDAMALUCA-----------------------------------//
new carroDU[2];
new correndo[MAX_PLAYERS];
new corrida = 0;
new cashp = 0;
new desafiante;
new colocado = 0;
new correndos[MAX_PLAYERS];
stock PlayerName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}
new Float:carroe[2][4] = //4 = 4 coordenadas | 3 = 3 "valores" (X,Y,Z)
{
{2037.5669,849.1274,6.3006,91.2613},
{2037.5853,854.5974,6.6984,91.7104}
};
new Float:racha[17][3] = //4 = 4 coordenadas | 3 = 3 "valores" (X,Y,Z)
{
{2021.9279,851.2713,6.4387},
{1806.2888,851.1154,10.3762},
{1597.7745,850.9503,6.4374},
{1315.8704,886.0849,6.5154},
{1227.3850,1170.5470,6.5219},
{1228.7192,1804.4149,6.4378},
{1229.5260,2301.2026,6.4387},
{1447.5416,2452.2988,6.4377},
{1849.4731,2497.6997,6.5153},
{2287.5569,2607.9063,6.4585},
{2609.7202,2514.3423,5.8201},
{2706.6592,2158.3931,6.4492},
{2705.5173,1674.4374,6.4448},
{2706.8931,1278.5399,6.4373},
{2624.1135,932.2136,6.4433},
{2312.5583,854.1749,6.4375},
{2049.3154,853.4050,6.4387}
};
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
stock strtokEx(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[64];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new tmp[128];
new string[128];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/corridamaluca", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USE: /corridamaluca [id] [Aposta]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(GetPlayerMoney(playerid) < money)
{
SendClientMessage(playerid,0xFFFFFFAA,"Vocк nгo tem Dinheiro Suficiente");
return 1;
}
if(corrida == 1)
{
SendClientMessage(playerid,0xFFFFFFAA,"Estб tendo um Racha");
return 1;
}
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
correndo[playerid] = 1;
carroDU[0] = CreateVehicle(434,carroe[0][0],carroe[0][1],carroe[0][2],carroe[0][3],1,0,60000);
cashp = money;
desafiante = playerid;
PutPlayerInVehicle(playerid, carroDU[0], 0);
TogglePlayerControllable(playerid, 0);
format(string,sizeof(string),"O Jogador %s Desafiou Vocк para uma Corrida , Aposta %d Cash !",PlayerName(playerid),money);
ShowPlayerDialog(playa,10,DIALOG_STYLE_MSGBOX,"Duelo",string,"Aceitar","Fechar");
}
}
}
return 1;
}
return 0;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
switch(correndos[playerid])
{
case 1:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[1][0], racha[1][1], racha[1][2], racha[2][0], racha[2][1], racha[2][2], 10);
correndos [playerid] = 2;
return 1;
}
case 2:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[2][0], racha[2][1], racha[2][2], racha[2][0], racha[2][1], racha[2][2], 10);
correndos[playerid] = 3;
return 1;
}
case 3:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[3][0], racha[3][1], racha[3][2], racha[3][0], racha[3][1], racha[3][2], 10);
correndos[playerid] = 4;
return 1;
}
case 4:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[4][0], racha[4][1], racha[4][2], racha[4][0], racha[4][1], racha[4][2], 10);
correndos[playerid] = 5;
return 1;
}
case 5:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[5][0], racha[5][1], racha[5][2], racha[5][0], racha[5][1], racha[5][2], 10);
correndos[playerid] = 6;
return 1;
}
case 6:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[6][0], racha[6][1], racha[6][2], racha[6][0], racha[6][1], racha[6][2], 10);
correndos[playerid] = 7;
return 1;
}
case 7:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[7][0], racha[7][1], racha[7][2], racha[7][0], racha[7][1], racha[7][2], 10);
correndos[playerid] = 8;
return 1;
}
case 8:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[8][0], racha[8][1], racha[8][2], racha[8][0], racha[8][1], racha[8][2], 10);
correndos[playerid] = 9;
return 1;
}
case 9:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[9][0], racha[9][1], racha[9][2], racha[9][0], racha[9][1], racha[9][2], 10);
correndos[playerid] = 10;
return 1;
}
case 10:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[10][0], racha[10][1], racha[10][2], racha[10][0], racha[10][1], racha[10][2], 10);
correndos[playerid] = 11;
return 1;
}
case 11:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[11][0], racha[11][1], racha[11][2], racha[11][0], racha[11][1], racha[11][2], 10);
correndos[playerid] = 12;
return 1;
}
case 12:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[12][0], racha[12][1], racha[12][2], racha[12][0], racha[12][1], racha[12][2], 10);
correndos[playerid] = 13;
return 1;
}
case 13:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[13][0], racha[13][1], racha[13][2], racha[13][0], racha[13][1], racha[13][2], 10);
correndos[playerid] = 14;
return 1;
}
case 14:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[14][0], racha[14][1], racha[14][2], racha[14][0], racha[14][1], racha[14][2], 10);
correndos[playerid] = 15;
return 1;
}
case 15:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[15][0], racha[15][1], racha[15][2], racha[15][0], racha[15][1], racha[15][2], 10);
correndos[playerid] = 16;
return 1;
}
case 16:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, racha[16][0], racha[16][1], racha[16][2], racha[16][0], racha[16][1], racha[16][2], 10);
correndos[playerid] = 17;
return 1;
}
case 17:
{
new strev[256];
DisablePlayerRaceCheckpoint(playerid);
colocado++;
switch(colocado)
{
case 1:
{
format(strev,sizeof(strev),"{ffffff}Vocк Chegou em {037b00}Primeiro {ffffff}Lugar no {037b00}Racha{ffffff} e Ganhou {037b00}%d Cash",cashp*2);
SendClientMessage(playerid,0xFFFFFFAA,strev);
format(strev,sizeof(strev),"{ffffff}O Jogador {037b00}%s{ffffff}Venceu o Racha e faturou {037b00}%d Cash",PlayerName(playerid),cashp*2);
SendClientMessageToAll(0xFFFFFFAA,strev);
DestroyVehicle(GetPlayerVehicleID(playerid));
correndo[playerid] = 0;
correndos[playerid] = 0;
corrida = 0;
GivePlayerMoney(playerid, cashp*2);
}
case 2:
{
format(strev,sizeof(strev),"{ffffff} Vocк {ff080e}perdeu {ffffff}o Racha ");
SendClientMessage(playerid,0xFFFFFFAA,strev);
cashp = 0;
correndo[playerid] = 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
colocado = 0;
correndos[playerid] = 0;
desafiante = 0;
return 1;
}
}
}
}
return 1;
}
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21)
{
if (text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos]))
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
userid = INVALID_PLAYER_ID;
}
else
{
return userid;
}
}
}
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof (name));
if (strcmp(name, text[pos], true, len) == 0)
{
if (len == strlen(name))
{
return i;
}
else
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count)
{
SendClientMessage(playerid, 0xFF0000AA, "Usuario Localizado");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Nenhum usuario encontrado");
}
}
userid = INVALID_PLAYER_ID;
}
return userid;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 10)
{
if(response)
{
TogglePlayerControllable(playerid, 0);
correndo[playerid] = 1;
GivePlayerMoney(desafiante, - cashp);
SetVehicleToRespawn(carroDU[1]);
carroDU[1] = CreateVehicle(434,carroe[1][0],carroe[1][1],carroe[1][2],carroe[1][3],1,0,60000);
PutPlayerInVehicle(playerid, carroDU[1], 0);
GivePlayerMoney(playerid, - cashp);
corrida = 1;
SetTimer("InicioCorrida", 1000, false);
}
else
{
TogglePlayerControllable(desafiante, 1);
cashp = 0;
SendClientMessage(desafiante,0xFFFF00AA," O Desafiado Recusou, Saia do Veiculo ");
return 1;
}
}
return 1;
}
forward InicioCorrida();
forward InicioCorrida2();
forward InicioCorrida3();
forward InicioCorrida4();
forward InicioCorrida5();
forward InicioCorridaGo();
public InicioCorrida()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "5", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida2", 1000, false);
return 1;
}
public InicioCorrida2()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "4", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida3", 1000, false);
return 1;
}
public InicioCorrida3()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "3", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida4", 1000, false);
return 1;
}
public InicioCorrida4()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "2", 1001, 5);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
SetTimer("InicioCorrida5", 1000, false);
return 1;
}
public InicioCorrida5()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(correndo[i] == 1)
{
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
GameTextForPlayer(i, "1", 1001, 5);
}
}
}
SetTimer("InicioCorridaGo", 1000, false);
return 1;
}
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
public InicioCorridaGo()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(correndo[i] == 1)
{
GameTextForPlayer(i, "~r~VALENDO!", 1001, 5);
TogglePlayerControllable(i, 1);
correndos[i] = 1;
SetPlayerRaceCheckpoint(i, 0, racha[0][0], racha[0][1], racha[0][2], racha[1][0], racha[1][1], racha[1][2], 10);
}
}
}
return 1;
}