09.05.2012, 17:54
Bump! Sorry for the double posting but time is of the essence.
Yes am very sorry for what I did but am in a rush, Hex colours.
|
new tmpColour1, tmpColour2;
sscanf(params, "xx", tmpColour1, tmpColour2);
GetRelativePosition( &Float:x, &Float:y, &Float:z, Float:angle, Float:offsetx, Float:offsety, Float:offsetz );
Hello I want Make /warn command But i fail more than one time , so can any one help me and make me one ?
|
#include <a_samp>
#include < zcmd >
#include < sscanf2 >
#define COLOR_GREEN 0x33AA33AA
#define RED 0xE60000AA
CMD:warn(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
if ( sscanf( params, "us", params[ 0 ],params[ 1 ]) )return SendUsage( playerid, "/warn <id> [reason]" );
if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!");
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
if( params[ 0 ] == playerid )return SendError( playerid, "Why would you want to warn yourself?Did you do something?");
++P_DATA[ params[ 0 ] ][ P_Warns ];
if( P_DATA[ params[ 0 ] ][ P_Warns ] < P_MAX_WARNS)
{
FormMessageForAllEx(playerid,COLOR_RED, "Administrator %s has givin a warning to %s! [Warn:%d/%d] [Reason: %s]",PlayerName2( playerid ), PlayerName2( params[ 0 ] ),P_DATA[ params[ 0 ] ][ P_Warns ],P_MAX_WARNS,params[ 1 ]);
FormMessage( params[ 0 ], COLOR_RED, "Administrator %s has warned you ! Dont make him to ban you [Warn:%d/%d] [Reason: %s]",PlayerName2( playerid ),P_DATA[ params[ 0 ] ][ P_Warns ],P_MAX_WARNS, params[ 1 ]);
FormMessage( playerid, COLOR_GREEN, "You have warned %s! [Warn:%d/%d] [Reason: %s]",PlayerName2( params[ 0 ] ),P_DATA[ params[ 0 ] ][ P_Warns ],P_MAX_WARNS,params[ 1 ]);
}
else if( P_DATA[ params[ 0 ] ][ P_Warns ] == P_MAX_WARNS )
{
FormMessageForAllEx(params[ 0 ],COLOR_GREEN, "%s has been kicked by the system! [Reason: Exceeding Warnings]",PlayerName2( params[ 0 ] ));
FormMessage( params[ 0 ], COLOR_GREEN, "You have been kicked by the system! [Reason: Exceeding Warnings]",0);
Kick( params[ 0 ] );
}
return 1;
}
Hi! Can someone help me with a /robplayer command?? Just an example please,i don't know how to start.
|
CMD:rob(playerid, params[]) { new string[128], pID; if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "Correct usage for command is: /rob playerid"); new cash = GetPlayerMoney(pID); new Float:steal = cash * 0.10; format(string, sizeof(string), "You have stolen %d from ID %i", floatround(steal), pID); SendClientMessage(playerid, -1, string); GivePlayerMoney(playerid, floatround(steal)); return 1; }
I really need help with one function that probably requires trigonometry:
Something like: pawn Код:
|
stock GetRelativePosition(& Float: X, & Float: Y, & Float: Z, Float: A, const Float: oX, const Float: oY, const Float: oZ) {
new
Float: cos = floatcos(A, degrees),
Float: sin = floatsin(A, degrees)
;
X += cos * oX - sin * oY;
Y += sin * oX + cos * oY;
Z += oZ;
}
new gangzone;
public OnGameModeInit()
{
gangzone = GangZoneCreate(1248.011, 2072.804, 1439.348, 2204.319);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerAdmin(playerid)) GangZoneShowForAll(gangzone,COLOR_RED);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
GivePlayerMoney(playerid, 5000);
DisablePlayerCheckpoint(playerid);
return 1;
}
#define TEAM_USA 1
#define TEAM_COLOR_USA COLOR_BLUE
#define TEAM_JAPAN 2
#define TEAM_COLOR_JAPAN COLOR_WHITE
#define TEAM_GERMANY 3
#define TEAM_COLOR_GERMANY COLOR_BROWN
#define TEAM_RUSSIA 4
#define TEAM_COLOR_RUSSIA COLOR_RED
#define TEAM_ENGLAND 5
#define TEAM_COLOR_ENGLAND COLOR_PLUM
#define TEAM_MEXICO 6
#define TEAM_COLOR_MEXICO COLOR_LIMEGREEN
#define TEAM_INDIA 7
#define TEAM_COLOR_INDIA COLOR_CORAL
#define TEAM_BRAZIL 8
#define TEAM_COLOR_BRAZIL COLOR_AQUA
#define TEAM_FRANCE 9
#define TEAM_COLOR_FRANCE COLOR_INDIGO
#define TEAM_INDONESIA 10
#define TEAM_COLOR_INDONESIA COLOR_BISQUE
#include <a_samp>
new fstr[128], bool:IsMasked[MAX_PLAYERS];
public OnFilterScriptInit() { return 1; }
public OnPlayerConnect(playerid)
{
IsMasked[playerid] = false;
return 1;
}
public OnPlayerText(playerid, text[])
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if (IsMasked[playerid])
{
format(fstr, sizeof(fstr), "[Stranger] %s: %s", playername, text);
SendClientMessageToAll(0xFFFFFFAA, fstr); // Change to ProxDetector or whatever if it's a RP script
return 0;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/mask", true))
{
if (IsMasked[playerid])
{
IsMasked[playerid] = false;
SendClientMessage(playerid, 0xFFFFFFAA, "You have successfully taken off your mask.");
}
else
{
IsMasked[playerid] = true;
SendClientMessage(playerid, 0xFFFFFFAA, "You have successfully put your mask.");
}
return 1;
}
return 0;
}