SA-MP Forums Archive
hay guys please make me a /callcar cmds - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: hay guys please make me a /callcar cmds (/showthread.php?tid=268297)



hay guys please make me a /callcar cmds - shaikh007 - 12.07.2011

hi guys how are you hoping fine from all of you.
i am new to samp forums and want you guys to help me make a callcar cmd
i want to have /callpriveh for my first vehicle and /callsecveh for my second car below is the script please help me out .

Quote:
Originally Posted by shaikh007
#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA

#include <a_samp>

new Summair;
new Summair1;

public OnFilterScriptInit()
{
Summair = AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
Summair1 = AddStaticVehicle(411,-1986.5643, 248.8863, 34.9182, 0, 0, 0);
AddVehicleComponent(Summair, 1036);
AddVehicleComponent(Summair, 1040);
AddVehicleComponent(Summair, 1034);
AddVehicleComponent(Summair, 1172);
AddVehicleComponent(Summair, 1149);
AddVehicleComponent(Summair, 1035);
AddVehicleComponent(Summair, 1002);
AddVehicleComponent(Summair, 1079);
return 1;
}


public OnPlayerStateChange(playerid, newstate, oldstate)
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

if(newstate == PLAYER_STATE_DRIVER) {
new Vehicle = GetPlayerVehicleID(playerid);
if(Vehicle == Summair) {
if(strcmp(PlayerName,"Summair",true)) {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: Summair");

}
}
if(Vehicle == Summair1) {
if(strcmp(PlayerName,"Summair",true)) {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0xAA3333AA, "This car is reserved for: Summair");
}
}

}
return 1;
}


public OnVehicleSpawn(vehicleid)
{
AddVehicleComponent(Summair, 1036);
AddVehicleComponent(Summair, 1040);
AddVehicleComponent(Summair, 1034);
AddVehicleComponent(Summair, 1172);
AddVehicleComponent(Summair, 1149);
AddVehicleComponent(Summair, 1035);
AddVehicleComponent(Summair, 1002);
AddVehicleComponent(Summair, 1079);
}



Re: hay guys please make me a /callcar cmds - [MG]Dimi - 12.07.2011

Like on your command vehicle spawns at your position and you are in it?


Re: hay guys please make me a /callcar cmds - shaikh007 - 12.07.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Like on your command vehicle spawns at your position and you are in it?
I Want To Get Cars To Me. When I Type /callpriveh my first car teleport to me and /callsecveh my second car teleport to me


Re: hay guys please make me a /callcar cmds - [MG]Dimi - 12.07.2011

Should work:
PHP код:
#define FILTERSCRIPT
#include <a_samp>

#define COLOR_RED 0xAA3333AA

new Summair1;
new 
Summair2;
new 
pName[MAX_PLAYER_NAME];
new 
pName1[MAX_PLAYER_NAME];
new 
Float:xFloat:yFloat:z;

public 
OnFilterScriptInit()
{
    
Summair1 AddStaticVehicle(562,-1959.1219,288.1400,35.1337,89.6646,145,145);
    
Summair2 AddStaticVehicle(411,-1986.5643248.886334.9182000);
    
AddVehicleComponent(Summair11036);
    
AddVehicleComponent(Summair11040);
    
AddVehicleComponent(Summair11034);
    
AddVehicleComponent(Summair11172);
    
AddVehicleComponent(Summair11149);
    
AddVehicleComponent(Summair11035);
    
AddVehicleComponent(Summair11002);
    
AddVehicleComponent(Summair11079);
    return 
1;
}


public 
OnPlayerCommandText(playeridcmdtext[])
{
    
GetPlayerName(playerid,pName,sizeof(pName));
    if (
strcmp("/callpriveh"cmdtexttrue10) == 0)
    {
        if(
strcmp("Summair",pName,true) == 0)
        {
            if(!
IsPlayerInAnyVehicle(playerid))
            {
                
GetPlayerPos(playerid,x,y,z);
                
SetVehiclePos(Summair1,x,y,z);
                
PutPlayerInVehicle(playerid,Summair1,0);
                return 
0;
            }
            return 
1;
        }
        return 
1;
    }
    if(
strcmp("/callsecveh",cmdtext,true,10) == 0)
    {
        if(
strcmp(pName,"Summair",true) == 0)
        {
            if(!
IsPlayerInAnyVehicle(playerid))
            {
                
GetPlayerPos(playerid,x,y,z);
                
SetVehiclePos(Summair2,x,y,z);
                
PutPlayerInVehicle(playerid,Summair2,0);
                return 
0;
            }
            else 
SendClientMessage(playerid,COLOR_RED,"ERROR: You must exit the vehicle before using this command!");
            return 
1;
        }
        return 
1;
    }
    return 
0;
}

public 
OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
    
GetPlayerName(playerid,pName1,sizeof(pName1));
    new 
vehid GetVehicleModel(vehicleid);
    if(
vehid == Summair1)
    {
        if(
strcmp("Summair",pName1,true) == 1)
        {
            
SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            
SendClientMessage(playerid,COLOR_RED,"ERROR: This vehicle belongs to Summair!");
            return 
1;
        }
    }
    if(
vehid == Summair2)
    {
        if(
strcmp("Summair",pName1,true) == 1)
        {
            
SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            
SendClientMessage(playerid,COLOR_RED,"ERROR: This vehicle belongs to Summair!");
            return 
1;
        }
    }
    return 
1;




Re: hay guys please make me a /callcar cmds - shaikh007 - 12.07.2011

It Works Thank you Dimi. Now If I want to make other player cars then how can i add them with cmd


Re: hay guys please make me a /callcar cmds - [MG]Dimi - 12.07.2011

No prob. Just follow same template as I used.
PHP код:
if(strcmp([command here],cmdtext,true,10) == 0)
    {
        if(
strcmp(pName,[Player name here]),true) == 0)
        {
            if(!
IsPlayerInAnyVehicle(playerid))
            {
                
GetPlayerPos(playerid,x,y,z);
                
SetVehiclePos([vehicle assigned variable],x,y,z);
                
PutPlayerInVehicle(playerid,[vehicle assigned variable],0);
                return 
0;
            }
            else 
SendClientMessage(playerid,COLOR_RED,"ERROR: You must exit the vehicle before using this command!");
            return 
1;
        }
        return 
1;
    } 
And For Preventing other players to enter:
PHP код:
if(vehid == [vehicle assigned variable])
    {
        if(
strcmp([Player name here],pName1,true) == 1)
        {
            
SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            
SendClientMessage(playerid,COLOR_RED,"ERROR: This vehicle belongs to [Player name here]!");
            return 
1;
        }
    } 



Re: hay guys please make me a /callcar cmds - shaikh007 - 12.07.2011

THank You So Much Now I Will make More Cars WIth That. I Was Making These Cars For MY Server And Soon I WIll Host My Server These Cars Will Be Only FOr Admins And Donators (VIPS)


Re: hay guys please make me a /callcar cmds - shaikh007 - 12.07.2011

I Tried My Thing But Dimi I Want To Have Same Cmd Of car for All Players


Re: hay guys please make me a /callcar cmds - [MG]Dimi - 12.07.2011

I don't understand. You want that every player on server can use it?


Re: hay guys please make me a /callcar cmds - shaikh007 - 12.07.2011

Yes. They Can Use If They Got Reserved Car If Not They Cant Use It. Message Popup Saying That "You Dont Got Reserved Car"