28.12.2010, 17:55
Hello guys, need some help here. I was away from scripting sa-mp, but my friends and I decided to create a new server, so I have several problems...
This code here, must be allowed to use only near your vehicle, the vehicle you own, the problem is that its usable near any vehicle, any server vehicle..
And the same happens with other commands i did like, /park .. It parks a not owned vehicle. I think the problem is with the function:
Anyways, I wanted to ask one more thing:
If you, buy a vehicle from menu, but not by entering the vehicle, how to create that vehicle and make a player its owner? How to get that vehicleid to use in enums? This is what I did:
and its called on GameModeInit by this code:
P.S. I save all information in .ini files, using Dini and i get the information that way too.
Thanks for help, looking forward.
This code here, must be allowed to use only near your vehicle, the vehicle you own, the problem is that its usable near any vehicle, any server vehicle..
Код:
if(!strcmp(params,"lock",true)) { new Float:X,Float:Y,Float:Z, msg[60]; for(new i=0; i<MAX_VEHICLES; i++) { if(!strcmp(carDB[i][cOwner],playerDB[playerid][name],true)) { GetVehiclePos(i,X,Y,Z); if(IsPlayerInRangeOfPoint(playerid,5,X,Y,Z)) { if(carDB[i][cLocked] == 1) { carDB[i][cLocked] = 0; format(msg,sizeof(msg)," * %s unlocks their vehicle. *",playerDB[playerid][name]); for(new p=0; p<MAX_PLAYERS; p++) { if(IsPlayerConnected(p)) { SetVehicleParamsForPlayer(i,p,0,0); } } } else if(carDB[i][cLocked] == 0) { carDB[i][cLocked] = 1; format(msg,sizeof(msg)," * %s locks their vehicle. *",playerDB[playerid][name]); for(new p=0; p<MAX_PLAYERS; p++) { if(IsPlayerConnected(p)) { SetVehicleParamsForPlayer(i,p,0,1); } } } GetPlayerPos(playerid,X,Y,Z); for(new a=0; a<MAX_PLAYERS; a++) { if(IsPlayerConnected(a) && IsPlayerInRangeOfPoint(a,30,X,Y,Z)) { SendClientMessage(a,CLR_ACTION,msg); } } return 1; } } } return 1; }
Код:
if(!strcmp(carDB[i][cOwner],playerDB[playerid][name],true))
If you, buy a vehicle from menu, but not by entering the vehicle, how to create that vehicle and make a player its owner? How to get that vehicleid to use in enums? This is what I did:
Код:
CreateVehicle(i) { carDB[i][ownedvehicle] = CreateVehicle(blah, blah, blah); }
Код:
for(new i=0; i<MAX_VEHICLES; i++) { CreateVehicle(i); }
Thanks for help, looking forward.