gabbii Posted August 1, 2011 Report Share Posted August 1, 2011 Am facut aceasta comanda pentru a porni motorul la masina si al opri utilizand comanda /engine, da nu merge de loc de la ce poate fi? [pawn] if(strcmp(cmd, "/engine",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);// |||||| SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); } else { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);// |||||| SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);//Here the VEHICLE_PARAMS_OFF will turn off your engine. } return 1; }[/pawn] Link to comment Share on other sites More sharing options...
Razvann Posted August 2, 2011 Report Share Posted August 2, 2011 new bool:Engine[ MAX_VEHICLES ];dcmd(engine, 6, cmdtext);dcmd_engine(playerid, params[ ]) { #pragma unused params new vid = GetPlayerVehicleID(playerid); new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); if(IsPlayerInAnyVehicle(playerid)) { if( !Engine[vid] ) { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); Engine[vid] = true; return true; } else { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); Engine[vid] = false; return true; } } return true;} Link to comment Share on other sites More sharing options...
gabbii Posted August 2, 2011 Author Report Share Posted August 2, 2011 new bool:Engine[ MAX_VEHICLES ];dcmd(engine, 6, cmdtext);dcmd_engine(playerid, params[ ]) { #pragma unused params new vid = GetPlayerVehicleID(playerid); new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); if(IsPlayerInAnyVehicle(playerid)) { if( !Engine[vid] ) { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); Engine[vid] = true; return true; } else { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); Engine[vid] = false; return true; } } return true;}nu merge da io nu folosesc dcmd..... Link to comment Share on other sites More sharing options...
Razvann Posted August 2, 2011 Report Share Posted August 2, 2011 In fine, mie-mi merge. Cu strcmp new bool: Engine[ MAX_VEHICLES ];if(strcmp(cmd, "/engine",true) == 0) { new vid = GetPlayerVehicleID(playerid); new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); if(IsPlayerInAnyVehicle(playerid)) { if( !Engine[vid] ) { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); Engine[vid] = true; return true; } else { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); Engine[vid] = false; return true; } } return true;} Link to comment Share on other sites More sharing options...
gabbii Posted August 2, 2011 Author Report Share Posted August 2, 2011 tot nu merge imi da erorile asteaD:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "engine" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "lights" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "alarm" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "doors" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "bonnet" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "boot" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "objective" shadows a variable at a preceding level Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase Header size: 10820 bytes Code size: 1953372 bytes Data size: 6935580 bytes Stack/heap size: 16384 bytes; estimated max. usage=5184 cells (20736 bytes) Total requirements: 8916156 bytes 7 Warnings. Link to comment Share on other sites More sharing options...
Razvann Posted August 2, 2011 Report Share Posted August 2, 2011 tot nu merge imi da erorile asteaD:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "engine" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "lights" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "alarm" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "doors" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "bonnet" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "boot" shadows a variable at a preceding level D:\samp03csvr_R2-2_win3\gamemodes\Copy (2) of czgammer.pwn(15047) : warning 219: local variable "objective" shadows a variable at a preceding level Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase Header size: 10820 bytes Code size: 1953372 bytes Data size: 6935580 bytes Stack/heap size: 16384 bytes; estimated max. usage=5184 cells (20736 bytes) Total requirements: 8916156 bytes 7 Warnings.posteaza tot codul tau sau sterge toata linia 15047. Link to comment Share on other sites More sharing options...
gabbii Posted August 2, 2011 Author Report Share Posted August 2, 2011 Io prima data aveam /engine[pawn] } if(strcmp(cmd, "/engine",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);// |||||| SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);//VEHICLE_PARAMS_ON is used to start the engine,it purely replace the engine thing! } return 1; }[/pawn]si /stopengine [pawn] if(strcmp(cmd, "/stopengine",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(vid != INVALID_VEHICLE_ID) { if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!"); GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);// |||||| SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);//Here the VEHICLE_PARAMS_OFF will turn off your engine. } return 1; }[/pawn] si am vrut sa fac sa pornesc motorul cu/engine si sa il opresc tot cu /engine da nu am reusit.... Link to comment Share on other sites More sharing options...
Razvann Posted August 2, 2011 Report Share Posted August 2, 2011 codul postat de mine face lucrul asta :) Link to comment Share on other sites More sharing options...
gabbii Posted August 3, 2011 Author Report Share Posted August 3, 2011 Am facut comanda /engine merge tot la ea da acum am 2 probleme:1. cand dau /engine in masina motorul porneste da imi apare in chat "SERVER: Unknown Command" 2. cand nu sunt in masina pot sa dau /engine si motorul porneste si se opreste...Uitati comanda[pawn] if(strcmp(cmd, "/engine",true) == 0) { new vid = GetPlayerVehicleID(playerid); if(EngineSTATE[vid] == 0) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); EngineSTATE[vid] = 1; GameTextForPlayer(playerid, "~g~Engine Started",500,3); } else { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); EngineSTATE[vid] = 0; GameTextForPlayer(playerid, "~r~Engine Stopped",500,3); } }[/pawn]Ce pot face? Link to comment Share on other sites More sharing options...
Razvann Posted August 3, 2011 Report Share Posted August 3, 2011 [pawn]if(strcmp(cmd, "/engine",true) == 0){ if( !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You are not in any vehicle."); new vid = GetPlayerVehicleID(playerid); if(IsABike(vid)) return SendClientMessage(playerid,-1,"This bike can't have engine."); if(EngineSTATE[vid] == 0) { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); EngineSTATE[vid] = 1; GameTextForPlayer(playerid, "~g~Engine Started",500,3); return 1; } else { GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); EngineSTATE[vid] = 0; GameTextForPlayer(playerid, "~r~Engine Stopped",500,3); return 1; }}[/pawn]wtf, pawn indenteaza aiurea Link to comment Share on other sites More sharing options...
Question
gabbii
Am facut aceasta comanda pentru a porni motorul la masina si al opri utilizand comanda /engine, da nu merge de loc de la ce poate fi?
[pawn] if(strcmp(cmd, "/engine",true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!");
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else
{
if(IsABBike(vid)) return SendClientMessage(playerid, COLOR_GRAD2, "This bike doesen't have engine!");
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
// ||||||
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
//Here the VEHICLE_PARAMS_OFF will turn off your engine.
}
return 1;
}[/pawn]
Link to comment
Share on other sites
9 answers to this question
Recommended Posts