/flip command -
megamind2067 - 09.11.2012
Hi, I need help with this command I am trying to edit in LuxAdmin. I am trying to make it
/flip (for anybody to use)
alone but currently it is a
/flip and /flip [id] cmd for admins
This is the original code:
Код:
dcmd_flip(playerid,params[])
{
if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
{
if(!strlen(params))
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
VehicleID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VehicleID, Angle);
SetVehiclePos(VehicleID, X, Y, Z);
SetVehicleZAngle(VehicleID, Angle);
SetVehicleHealth(VehicleID,1000.0);
SendCommandToAdmins(playerid,"Flip");
return SendClientMessage(playerid, green,"|- Vehicle Flipped! -|") &&
SendClientMessage(playerid, white,"Flip the player's vehicle? (/flip [PlayerID])");
}
else return SendClientMessage(playerid,red,"ERROR: You are not in a Vehicle!");
}
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
{
SendCommandToAdmins(playerid,"Flip");
if (IsPlayerInAnyVehicle(player1))
{
new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(player1, X, Y, Z);
VehicleID = GetPlayerVehicleID(player1);
GetVehicleZAngle(VehicleID, Angle);
SetVehiclePos(VehicleID, X, Y, Z);
SetVehicleZAngle(VehicleID, Angle);
SetVehicleHealth(VehicleID,1000.0);
SendCommandToAdmins(playerid,"Flip");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,sizeof(string),"|- Administrator %s Flipped your Vehicle -|",adminname);
SendClientMessage(player1,blue,string);
format(string,sizeof(string),"You have Flipped %s's Vehicle!", playername);
return SendClientMessage(playerid, blue,string);
}
else return SendClientMessage(playerid,red,"ERROR: This player isn't in a vehicle");
}
else return ErrorMessages(playerid, 4);
}
else return ErrorMessages(playerid, 1);
}
And this is what I have:
Код:
dcmd_flip(playerid,params[])
{
if(!strlen(params))
{
if(IsPlayerInAnyVehicle(playerid))
{
new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
VehicleID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VehicleID, Angle);
SetVehiclePos(VehicleID, X, Y, Z);
SetVehicleZAngle(VehicleID, Angle);
SetVehicleHealth(VehicleID,1000.0);
SendCommandToAdmins(playerid,"Flip");
return SendClientMessage(playerid, green,"|- Vehicle Flipped! -|") &&
SendClientMessage(playerid, white,"Flip the player's vehicle? (/flip [PlayerID])");
}
else return SendClientMessage(playerid,red,"ERROR: You are not in a Vehicle!");
}
}
return 1;
And these are the errors I get:
SAMP\Torreto Racing(1)\filterscripts\LuxAdmin.pwn(4584) : warning 209: function "dcmd_flip" should return a value
SAMP\Torreto Racing(1)\filterscripts\LuxAdmin.pwn(4585) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
[/CODE]
Re: /flip command -
Konstantinos - 09.11.2012
It is very simple.
pawn Код:
dcmd_flip( playerid, params[ ] )
{
if( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
new
Float:Angle
;
GetVehicleZAngle( GetPlayerVehicleID( playerid ), Angle );
SetVehicleZAngle( GetPlayerVehicleID( playerid ), Angle );
// Rest of code, messages or something else
return 1;
}
else return SendClientMessage( playerid, -1, "You need to be in a vehicle" );
}