Vehicle system Help
#1

Hello SAMP Members,

I am seriously a begginer scripter and i need your help with something.I need an command,which can give a car to the player (Making him the owner of this car) and he will be able to park it or call it.

I mean,i scripted a /callcar command,can you check for any mistakes?:
Код:
if(!strcmp(cmd,"/CallCar",true))
	{
	    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"Get out from your vehicle");
	    if(dini_Int(pFile(playerid),"HaveCar") == 0) return SendClientMessage(playerid,red,"You dont have vehicle");
        new Float:x,Flaot:y,Flaot:z,Flaot:a;
	    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
	    GetPlayerFacingAngle(playerid,Float:a);
	    DontDeleteNeon[CarID(playerid)] = 1;
		SetVehicleToRespawn(CarID(playerid));
		GetPlayerPos(playerid,Float:x,Float:y,Float:z);
		SetVehiclePos(CarID(playerid),Float:x,Float:y,Float:z);
		PutPlayerInVehicle(playerid,CarID(playerid),0);
		SetVehicleZAngle(CarID(playerid),Float:a);
		PlayerPlaySound(playerid,1083,0.0,0.0,0.0);
		return SendClientMessage(playerid,green3,"Your car has been teleported to you you!");
	}
I have also a command like this,but when i give the car,when the player logs off he dont own any car:

Код:
CMD:givecar(playerid,params[]) { 
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { 
        if(isnull(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]"); 
        new player1 = strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; 
        if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); 
     if(IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle"); 
         if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) { 
            CMDMessageToAdmins(playerid,"GIVECAR"); 
            new Float:x, Float:y, Float:z;    GetPlayerPos(player1,x,y,z); 
            CarSpawner(player1,415); 
            GetPlayerName(player1, playername, sizeof(playername));        GetPlayerName(playerid, adminname, sizeof(adminname)); 
            format(string,sizeof(string),"Administrator %s has given you a car",adminname);    SendClientMessage(player1,blue,string); 
            format(string,sizeof(string),"You have given %s a car", playername); return SendClientMessage(playerid,blue,string); 
        } else return SendClientMessage(playerid, red, "Player is not connected or is yourself"); 
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); 
}
Check the car park command please,and tell me how can i mix all of them and make an normall vehicle system.with /givecar ,/callcar and /apark command :
Код:
if (strcmp(cmd, "/apark", true) ==0 )
	{
	if(!IsPlayerInAnyVehicle(playerid)){return 1;}
	if(!IsPlayerAdmin(playerid)){return 1;}
	if(GetCreatorID(vehicleid)!=0)
	{
	new Float:vx,Float:vy,Float:vz,Float:va;
	GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
	GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
	VehicleSystem[GetCreatorID(vehicleid)][x]=vx;
	VehicleSystem[GetCreatorID(vehicleid)][y]=vy;
	VehicleSystem[GetCreatorID(vehicleid)][z]=vz;
	VehicleSystem[GetCreatorID(vehicleid)][a]=va;
	SendClientMessage(playerid,WHITE,"Admin Park!");
	SaveTool();
	}
	else
	{
	SendClientMessage(playerid,WHITE," You Can't Park This Car!");
	}
	return 1;
	}
In conclusion,i want really thank you for reading my post,and i will appreciate your help!Hope to hear from you soon!

Best regards,
George
Reply
#2

Anyone?
Reply
#3

Ok so the reason he doesn't own the car doesn't save when he logs off is because it's not in saved into their .ini user profile. Are you using a pre-made GM (made by someone else)? If so which one?
Reply
#4

I am not using any gamemode!I am helping one friend!! But his gamemode is not pre-made!Fully compiled by him!
Reply
#5

The problem hs that I cant share the gamemode :/
Reply
#6

Anyone else?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)