06.09.2012, 06:31
(
Last edited by XtremeR; 29/09/2012 at 04:52 PM.
)
Hello, Today i will teach you guys how to make Steal Able Cars.. its simple easy and fast..
First Step: Defining Teams
Second Step: Making Vehicles
You can use any editor for the Vehicles once u have the Vehicle code like i have
Now goto " OnGameModeInt " or " OnFilterScriptInt "
and add the following :
Now we have added the Cars Successfully
Third Step: Entering Vehicles
You can use GameText For Player or u can also Use Textdraw or Even SendClientMessage to give a Message to the Player.
Goto " OnPlayerStateChange "
and write:
Last(4th) Step: Giving Rewards
After Reaching the Checkpoint Rewards for the Player:
Fixing the Error of PlayPlayerSound(sound)
You're Done Now!
Thanks For looking At My Tut
thanks to the guy who made Rivershell (took some ideas from it)
+Rep if u liked it
First Step: Defining Teams
pawn Code:
#define TEAM_ONE 1
#define TEAM_TWO 2
new PlayerTeam[MAX_PLAYERS];//we will use this down
new car1;//team one car
new car2;//team two car
You can use any editor for the Vehicles once u have the Vehicle code like i have
pawn Code:
AddStaticVehicleEx(470,-1632.75170898,1294.86474609,7.14550352,138.00000000,-1,-1,15);
and add the following :
pawn Code:
car1 = AddStaticVehicleEx(470,-1632.75170898,1294.86474609,7.14550352,138.00000000,-1,-1,15);
pawn Code:
car2 = AddStaticVehicleEx(447,-1690.72692871,1380.04211426,14.88139153,224.00000000,-1,-1,15);
Third Step: Entering Vehicles
You can use GameText For Player or u can also Use Textdraw or Even SendClientMessage to give a Message to the Player.
Goto " OnPlayerStateChange "
and write:
pawn Code:
new vehicleid;//Defining Vehicle id
if(newstate == PLAYER_STATE_DRIVER)//checking that if the state is driver or not
{
vehicleid = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == TEAM_ONE && vehicleid == car2)//team one and Car 2
{
GameTextForPlayer(playerid, "Enemy Vehicle! ~g~Take it Back to your Spawn", 3000, 5);
SetPlayerCheckpoint(playerid, 2241.1335,-1318.9760,23.9844, 7.0);
SendClientMessageToAll(playerid,-1,"Team One is trying to Steal Team Two's Car");
}
else if(gTeam[playerid] == TEAM_ONE && vehicleid == car1)//Teams Vehicle
{
GameTextForPlayer(playerid, "You Need to Protect This From your Enemy", 3000, 5);
RemovePlayerFromVehicle(playerid); // player out of vehicle
}
else if(gTeam[playerid] == TEAM_TWO && vehicleid == car1)//team 2 and Car 1
{
GameTextForPlayer(playerid, "Enemy Vehicle! ~g~Take it Back to your Spawn", 3000, 5);
SetPlayerCheckpoint(playerid, 2241.1335,-1318.9760,23.9844, 7.0);
SendClientMessageToAll(playerid,-1,"Team Two is trying to Steal Team One's Car");
else if(gTeam[playerid] == TEAM_TWO && vehicleid == car2)//team 2 car 2
{
GameTextForPlayer(playerid, "You Need to Protect This From your Enemy", 3000, 5);
RemovePlayerFromVehicle(playerid); // player out of vehicle
}
}
}
After Reaching the Checkpoint Rewards for the Player:
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
new playervehicleid = GetPlayerVehicleID(playerid);//Playerid = GetPlayerVehicle ID Easier for me
if(gTeam[playerid] == TEAM_ONE)//Getting that if the player is from Team One
{
if(playervehicleid == car2)//getting that if the car is car 2
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);//giving 5 score
GameTextForAll("~g~Team ~w~One ~g~Captured the Vehicle!", 3000, 5);//telling everyone that Team one did it
PlaySoundForAll(1185, 0.0, 0.0, 0.0);//playing a Sound for the Winners
SetVehicleToRespawn(car2);//respawn the Vehicle
}
}
else if(gTeam[playerid] == TEAM_TWO)//getting players team
{
if(playervehicleid == car1)//get that if the player is in car 1
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 5);//giving the score
GameTextForAll("~r~Team ~w~Two ~g~wins!", 3000, 5);//Gametext for all that Team TWO Wins
PlaySoundForAll(1185, 0.0, 0.0, 0.0);//sound for the winners
GameTextForAll("~g~Team ~w~Two ~g~Captured the Vehicle!", 3000, 5);//telling everyone that Team Two did it
SetVehicleToRespawn(car1);//respawn the Vehicle
}
}
return 1;
}
pawn Code:
PlayPlayerSound(sound)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
}
}
Thanks For looking At My Tut
thanks to the guy who made Rivershell (took some ideas from it)
+Rep if u liked it