Originally Posted by Warriors_Tornado
oh well am serching millions times and cant find it how can i cretae race
i have Cp streamer thats why i can create many races but i want to learn ho e to create one what commands,etc.i ned to create a race from CP with race,timer etc. Can someone realy help or give pastebin code or something lse I am tired of seraching beceuse nowhere anybody can tell Always others just says iofftopiic and thats all Answer only these who can help Thankyou ![]() ![]() |
new Status[MAX_PLAYERS];
new CheckPoints[4][3] = //4 = 4 slots | 3 = 3 "values" (X,Y,Z)
{
{X,Y,Z},
{X,Y,Z},
{X,Y,Z},
{X,Y,Z}
};
if(strcmp(cmdtext, "/start", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i)) //to every1 in teh server
{ //0 = normal-------1 = slot 1 | 1 = X---
SetPlayerRaceCheckpoint(i, 0, Checkpoints[1][1], Checkpoints[1][2], Checkpoints[1][3], Checkpoints[2][1], Checkpoints[2][2], Checkpoints[2][3], 10);//10 maybe??
Statur[i] = 1;
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Only for admin's");
}
}
public OnPlayerEnterCheckpoint(playerid)
{
switch(Status[playerid])
{
case 1:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[2][1], Checkpoints[2][2], Checkpoints[2][3], Checkpoints[3][1], Checkpoints[3][2], Checkpoints[3][3], 10);
Status[i] = 2;
return 1;
}
case 2:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 0, Checkpoints[3][1], Checkpoints[3][2], Checkpoints[3][3], Checkpoints[4][1], Checkpoints[4][2], Checkpoints[4][3], 10);
Status[i] = 3;
return 1;
}
case 3:
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 1, Checkpoints[4][1], Checkpoints[4][2], Checkpoints[4][3], Checkpoints[4][1], Checkpoints[4][2], Checkpoints[4][3]-5, 10); //so it looks down
Status[i] = 4;
return 1;
}
case 4:
{
DisablePlayerRaceCheckpoint(playerid);
GameTextForPlayer(playerid, "You have won the race!!", 3000, 1);
GivePlayerMoney(playerid, 10000);
return 1;
}
}
}
//Wherever you want to start the race
SetPlayerRaceCheckpoint(i, 0, 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 20.0);
SetPVarInt(playerid, "Race", 1);
public OnPlayerEnterCheckpoint(playerid)
{
switch(GetPVarInt(playerid, "Race"))
{
case 1:
{
DisablePlayerRaceCheckpoint(playerid);
switch(GetPVarInt(playerid, "Status"))
{ //Sure you could do that with an array as well but I dont like to waste memory
case 0: SetPlayerRaceCheckpoint(playerid, 0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 20.0);
case 1: SetPlayerRaceCheckpoint(playerid, 0, 10.0, 10.0, 10.0, -3.0, -3.0, -3.0, 20.0);
case 2: SetPlayerRaceCheckpoint(playerid, 0, -3.0, -3.0, -3.0, 2.0, 2.0, 2.0, 20.0);
case 3: SetPlayerRaceCheckpoint(playerid, 1, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0, 20.0);
case 4:
{
new string[64];
static Ranks;
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
switch(++Rank)
{
case 1: format(string, sizeof string, "~r~%s ~b~won the race (race1)", string);
case 2: format(string, sizeof string, "~r~%s ~b~is second (race1)", string);
case 3: format(string, sizeof string, "~r~%s ~b~is third (race1)", string);
}
DeletePVar(playerid, "Race");
DeletePVar(playerid, "Status");
SendClientMessageToAll(0xFF0000AA, string);
return GivePlayerMoney(playerid, Rank * 5000);
}
}
return SetPVarInt(playerid, "Status", GetPVarInt(playerid, "Status") + 1);
}
}
}