Help pls
#1

i made team cars script.


i add 2 ballas skins one is 104 and one 106 and i made team cars for them but skin 104 can drive car but not 106 help me pls

i made this team vehicles for grove and ballas same problem with both only skins 1 can drive not others

i mean like 104 can drive but not 106 and 107 can drive but not 109
Reply
#2

show us some codes? Somehow people keep expecting us to fix their issues without including codes. smh
Reply
#3

Code? We can't enter in your mind and see the code...
Reply
#4

i used this codes https://sampforum.blast.hk/showthread.php?tid=160810

i only used his team vehicles code
Reply
#5

Show the code from YOUR script from PAWNO...
Reply
#6

Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <core>
#include <float>

#include <cnr/commands>
#include <cnr/cnr_dialogresponse>

#define BALLAS 0
#define BALLAS2 1
#define GROVE 2
#define GROVE2 3

enum TeamCars
{
Ballas,
Grove
}

new gTeam[MAX_PLAYERS];
new Cars[TeamCars];

#pragma tabsize 0

main()
{
	print("\n----------------------------------");
	print("  DBH4LYF\n");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{  
	SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);

	new pname[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "{FF6600}%s {FFFFFF}Has Connected To The Server", pname);
    SendClientMessageToAll(COLOR_WHITE, string);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
    
    new pname[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "{FF6600}%s {FFFFFF}Has Left The Server (Timeout/Crashed)", pname);
        case 1: format(string, sizeof(string), "{FF6600}%s {FFFFFF}Has Left The Server (Quit)", pname);
        case 2: format(string, sizeof(string), "{FF6600}%s {FFFFFF}Has Left The Server (Kicked/Banned)", pname);
    }
    SendClientMessageToAll(COLOR_WHITE, string);
    return 1;
}

public OnPlayerSpawn(playerid)
{  
	SetPlayerInterior(playerid,0);
	TogglePlayerClock(playerid,0);
	ResetPlayerWeapons(playerid);
	SetPlayerArmour(playerid, 100.0);

	new Skin=GetPlayerSkin(playerid);
	switch(Skin)
	{
		case 102,104: //The Skins Which Will Be Ally
		{
			SetPlayerTeam(playerid,BALLAS);
        	GivePlayerWeapon(playerid, 24, 9999);
        	GivePlayerWeapon(playerid, 25, 9999);
        	GivePlayerWeapon(playerid, 32, 9999);
        	GivePlayerWeapon(playerid, 34, 9999);
        	GivePlayerWeapon(playerid, 30, 9999);
        	SetPlayerPos(playerid, -2569.7415, 892.6765, 64.9844);
        	GameTextForPlayer(playerid, "~p~You spawned as ballas", 1000, 3);
		}
		case 106,107: //The Skins Which Will Be Ally
		{
			SetPlayerTeam(playerid,GROVE);
			GivePlayerWeapon(playerid, 24, 9999);
        	GivePlayerWeapon(playerid, 25, 9999);
        	GivePlayerWeapon(playerid, 28, 9999);
        	GivePlayerWeapon(playerid, 34, 9999);
        	GivePlayerWeapon(playerid, 31, 9999);
        	SetPlayerPos(playerid, -1704.2889, 1018.0909, 17.5859);
        	GameTextForPlayer(playerid, "~g~You spawned as grove", 1000, 3);
		}
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    return 1;
}

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(!success)
	{
    SendClientMessage(playerid, COLOR_WHITE, "SERVER: {FF0000}You typed an unknwon command, {FFFFFF}Type {FF6600}/help {FFFFFF}to see server commands");
    }
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
    	new string[128], dead[24], killer[24];
        GameTextForPlayer(issuerid, "~r~Headshot!",3000,4); 
        GetPlayerName(playerid, dead, sizeof(dead)); 
        GetPlayerName(issuerid, killer, sizeof(killer));
        format(string, sizeof(string), "{FFFF00}%s (%i) {FF0000}Popped {FFFF00}%s (%i) Head With a Sniper Rifle", killer, issuerid, dead, playerid);
        SendClientMessageToAll(COLOR_WHITE, string); 
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if( GetPlayerTeam(playerid) != NO_TEAM
		&& IsPlayerConnected(damagedid)
		&& GetPlayerTeam(playerid) == GetPlayerTeam(damagedid))
	{
    	GameTextForPlayer(playerid, "~r~Don't attack your Teammates", 1000, 3);
    	return 0;
    }
	return 1;
}

SetupPlayerForClassSelection(playerid)
{
 	SetPlayerInterior(playerid, 3);
	SetPlayerPos(playerid, 516.9618, -12.4622, 1001.5653);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid, 521.2418, -12.8726, 1003.3655);
	SetPlayerCameraLookAt(playerid, 520.2465, -12.7885, 1002.9908);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        SetPlayerSkin(playerid, 102);
        GameTextForPlayer(playerid, "~p~Ballas", 1000, 4);
        SetPlayerColor(playerid, COLOR_PURPLE);
        gTeam[playerid] = 1; //class 0 will be ally of class 1
    }
    if(classid == 1)
    {
        SetPlayerSkin(playerid, 104);
        GameTextForPlayer(playerid, "~p~Ballas", 1000, 4);
        SetPlayerColor(playerid, COLOR_PURPLE);
        gTeam[playerid] = 0; //class 1 will be ally of class 0
    }
    if(classid == 2) 
    {
        SetPlayerSkin(playerid, 106);
        GameTextForPlayer(playerid, "~g~Grove", 1000, 4);
        SetPlayerColor(playerid, COLOR_GREEN);
        gTeam[playerid] = 3;//class 2 will be ally of class 3
    }
    if(classid == 3) 
    {
        SetPlayerSkin(playerid, 107);
        GameTextForPlayer(playerid, "~g~Grove", 1000, 4);
        SetPlayerColor(playerid, COLOR_GREEN);
        gTeam[playerid] = 2;//class 3 will be ally of class 2
    }

 	SetupPlayerForClassSelection(playerid);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    SendClientMessage(playerid, COLOR_WHITE, "Welcome To The {FF6600}Dark Mapping Server{FFFFFF}");
	SendClientMessage(playerid, COLOR_WHITE, "Type {FF6600}/help {FFFFFF}to see server commands");
    return 1;
}

public OnGameModeInit()
{
	SetGameModeText("DBH4LYF");
	ShowPlayerMarkers(1);
	ShowNameTags(1);
	AllowAdminTeleport(1);
	DisableInteriorEnterExits();
	EnableStuntBonusForAll(0);

	//ballas skins
    AddPlayerClass(102, 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0); //ballas1
    AddPlayerClass(104, 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0); //ballas2
    //grove skins
    AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0); //grove1
    AddPlayerClass(107, 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0); //grove2
    //vehicles
    Cars[Ballas] = CreateVehicle(492,2484.3054,-1655.0886,13.1036,90.8565,44,16,900);
    Cars[Grove] = CreateVehicle(596,1536.0603,-1676.5302,13.1054,0.6847,-1,-1,900);
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
      	new CarCheck = GetPlayerVehicleID(playerid);
    	if(CarCheck == Cars[Ballas] )
        {
        	if(gTeam[playerid] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
            	return 1;
			}
		}
		if(CarCheck == Cars[Grove] )
        {
			if(gTeam[playerid] != 2)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't have the keys for this car!");
                return 1;
            }
        }
       	return 1;
    }
    return 1;
}
Reply
#7

try this:
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if(
classid == 0)
    {
        
SetPlayerSkin(playerid102);
        
GameTextForPlayer(playerid"~p~Ballas"10004);
        
SetPlayerColor(playeridCOLOR_PURPLE);
        
gTeam[playerid] = 0//BFF with 1
    
}
    if(
classid == 1)
    {
        
SetPlayerSkin(playerid104);
        
GameTextForPlayer(playerid"~p~Ballas"10004);
        
SetPlayerColor(playeridCOLOR_PURPLE);
        
gTeam[playerid] = 0//BFF with 0
    
}
    if(
classid == 2
    {
        
SetPlayerSkin(playerid106);
        
GameTextForPlayer(playerid"~g~Grove"10004);
        
SetPlayerColor(playeridCOLOR_GREEN);
        
gTeam[playerid] = 1;//BFF with 3
    
}
    if(
classid == 3
    {
        
SetPlayerSkin(playerid107);
        
GameTextForPlayer(playerid"~g~Grove"10004);
        
SetPlayerColor(playeridCOLOR_GREEN);
        
gTeam[playerid] = 1;//BFF with 2
    
}
     
SetupPlayerForClassSelection(playerid);
    return 
1;

Reply
#8

Quote:
Originally Posted by 10MIN
Посмотреть сообщение
try this:
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if(
classid == 0)
    {
        
SetPlayerSkin(playerid102);
        
GameTextForPlayer(playerid"~p~Ballas"10004);
        
SetPlayerColor(playeridCOLOR_PURPLE);
        
gTeam[playerid] = 0//BFF with 1
    
}
    if(
classid == 1)
    {
        
SetPlayerSkin(playerid104);
        
GameTextForPlayer(playerid"~p~Ballas"10004);
        
SetPlayerColor(playeridCOLOR_PURPLE);
        
gTeam[playerid] = 0//BFF with 0
    
}
    if(
classid == 2
    {
        
SetPlayerSkin(playerid106);
        
GameTextForPlayer(playerid"~g~Grove"10004);
        
SetPlayerColor(playeridCOLOR_GREEN);
        
gTeam[playerid] = 1;//BFF with 3
    
}
    if(
classid == 3
    {
        
SetPlayerSkin(playerid107);
        
GameTextForPlayer(playerid"~g~Grove"10004);
        
SetPlayerColor(playeridCOLOR_GREEN);
        
gTeam[playerid] = 1;//BFF with 2
    
}
     
SetupPlayerForClassSelection(playerid);
    return 
1;

EDITED : bro awesome <3 your codes is correct i just need to change team from public OnPlayerStateChange and it's fixed <3 and can u tell me how to rep players xD
Reply
#9

hmm.......
Try to put this under OnPlayerEnterVehicle like:
PHP код:
OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
        if(
vehicleid == Cars[Ballas] && !ispassenger)
        {
            if(
gTeam[playerid] != 1)
            {
                
RemovePlayerFromVehicle(playerid);
                
SendClientMessage(playeridCOLOR_RED"You Don't have the keys for this car!");
                return 
1;
            }
        }
    if(
vehicleid == Cars[Grove] && !ispassenger)
        {
            if(
gTeam[playerid] != 2)
                {
                    
RemovePlayerFromVehicle(playerid);
                    
SendClientMessage(playeridCOLOR_RED"You Don't have the keys for this car!");
                    return 
1;
                }
        }
           return 
1;

And remove that code from OnPlayerStateChange
Reply
#10

Quote:
Originally Posted by 10MIN
Посмотреть сообщение
try this:
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if(
classid == 0)
    {
        
SetPlayerSkin(playerid102);
        
GameTextForPlayer(playerid"~p~Ballas"10004);
        
SetPlayerColor(playeridCOLOR_PURPLE);
        
gTeam[playerid] = 0//BFF with 1
    
}
    if(
classid == 1)
    {
        
SetPlayerSkin(playerid104);
        
GameTextForPlayer(playerid"~p~Ballas"10004);
        
SetPlayerColor(playeridCOLOR_PURPLE);
        
gTeam[playerid] = 0//BFF with 0
    
}
    if(
classid == 2
    {
        
SetPlayerSkin(playerid106);
        
GameTextForPlayer(playerid"~g~Grove"10004);
        
SetPlayerColor(playeridCOLOR_GREEN);
        
gTeam[playerid] = 1;//BFF with 3
    
}
    if(
classid == 3
    {
        
SetPlayerSkin(playerid107);
        
GameTextForPlayer(playerid"~g~Grove"10004);
        
SetPlayerColor(playeridCOLOR_GREEN);
        
gTeam[playerid] = 1;//BFF with 2
    
}
     
SetupPlayerForClassSelection(playerid);
    return 
1;

yep , this one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)