Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dudb>
- #include <color>
- main(){print("GameMode Loaded");}
- new Faction[MAX_PLAYERS];
- /*
- With new we create a new variable.
- We can store numbers in a variable.
- So if Faction = 0 then the player didn't join one
- if Faction = 1 then a player joined LSPD(Example) and if
- Faction = 2 then player joined Taxi Drivers(Example)
- So you can make as many factions you want.
- Just make a list:
- Nothing = 0
- LSPD = 1
- Taxi Driver = 2
- Car Jacker = 3
- Civilian = 4
- To check if the player is in a faction you add the following lines:
- if(Faction[playerid] == 0) // 0 is a example you can replace it with any number (0 = No Faction)
- {
- // Here what must hapen with the player is the faction = the id you typed
- }
- else
- {
- // Here what must hapen with the player if he is not the faction
- } */
- public OnGameModeInit()
- {
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- // Saving the id of the faction on player connect
- public OnPlayerConnect(playerid)
- {
- new formatZ[256];
- new pName[MAX_PLAYER_NAME];
- new string[48];
- format(formatZ,sizeof(formatZ),"%s.txt",PlayerName(playerid));
- if(!udb_Exists(formatZ))
- {
- udb_Create(formatZ,"209010");
- }
- Faction[playerid] = dUserINT(formatZ).("Faction");
- return 1;
- }
- // Saving the id of the faction on player disconnect
- public OnPlayerDisconnect(playerid, reason)
- {
- new formatZ2[256];
- new pName[MAX_PLAYER_NAME];
- new string[56];
- format(formatZ2,sizeof(formatZ2),"%s.txt",PlayerName(playerid));
- dUserSetINT(formatZ2).("Faction",Faction[playerid]);
- return 1;
- }
- stock PlayerName(playerid) {
- new name[255];
- GetPlayerName(playerid, name, 255);
- return name;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/joinfaction", cmdtext, true, 10) == 0)
- {
- // Copy this command as much as you want and edit it to create multiple join faction command
- SendClientMessage(playerid, COLOR_RED, "* You joined faction 1");
- Faction[playerid] = 1; // << With this we set Faction ID to 1, change 1 to any Faction ID */
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment