Sāksim ar to kā uztaisīt elementāru teksta komandiņu. Atveram pawno spiežam File>New un sākam dzēst lieko līdz paliek sekojošais
Code
#include <a_samp>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
Tālāk ķeramies klāt pie
Code
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
Do something here vietā ierakstām SendClientMessage, izvēlamies krāsu
Code
#define COLOR_BLUE 0x0000FFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_PURPLE 0x9900FFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_ORANGE 0xFF9933AA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_TAN 0xFFFFCCAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_KHAKI 0x999900AA
#define COLOR_LIME 0x99FF00AA
#define COLOR_BLACK 0x000000AA
#define COLOR_TURQ 0x00A3C0AA
( krāsas ņemtas no kaut kāda GM ) kad esam izvēlējušies krāsu taisam to visu kopā lai izskatās šādi ->
Code
if (strcmp("/spam", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,COLOR_TURQ,"Ej tu nost tads spams jebal.");
return 1;
}
Galvenais atcerieties ---- SendClientMessage --- obligāti jābūt katram nākošajam vārdam ar lielajiem burtiem savādāk nevarēs uztaisīt Complie. Un pavisam šai vienkāršajai komandiņai vajadzētu izskatīties šādi kopumā
Code
#include <a_samp>
#define COLOR_TURQ 0x00A3C0AA
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Tavs FS nosaukums seit - Piem - MultiScript");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/spam", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,COLOR_TURQ,"Ej tu nost tads spams jebal.");
return 1;
}
return 0;
}
Tālāk jau varam taisīt complie un viss strādās.
-------------------------------------------------------------------------------
Ķeramies pie teleportiem ( teleportu paraugs no Nismo dotā parauga man kādu laiku atpakaļ )
Sākumā iejam serverī nokļūstam kādā konkrētā vajadzīgā vietā. Piem. man šī vieta būs @ LV Drifta stāvietā ! Sākumā tas viss izskatās šādi
Code
AddStaticVehicle(518,2316.0850,1447.9220,42.4912,269.6896,0,1);
tālāk izņemam vajadzīgās kordinātes
Code
2316.0850,1447.9220,42.4912
proti pirmās sešas kas seko pēc mašīnas/skina ID.
šīs pēdējās kordinates nav diezko svarīgas bet tomēr vajadzīgas. Tātad paraugs priekš teleporta
Code
if(strcmp(cmdtext, "/driftlv", true) == 0) {
if(IsPlayerInAnyVehicle(playerid) == 1) {
SetPlayerInterior(playerid, 0);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
SetVehiclePos(GetPlayerVehicleID(playerid),PIRMAIS SEŠINIEKS);
SetVehicleZAngle(GetPlayerVehicleID(playerid), PĒDĒJĀS DIVAS);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
} else {
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid,PIRMAIS SEŠINIEKS);
SetPlayerFacingAngle(playerid, PĒDĒJĀS DIVAS);
SetCameraBehindPlayer(playerid);
}
} else {
SetPlayerPos(playerid,PIRMAIS SEŠINIEKS);
SetPlayerFacingAngle(playerid, PĒDĒJĀS DIVAS);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 0);
}
return 1;
}
Kad saliekam kordinātes izskatās aptuveni šādi
Code
if(strcmp(cmdtext, "/driftlv", true) == 0) {
if(IsPlayerInAnyVehicle(playerid) == 1) {
SetPlayerInterior(playerid, 0);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
SetVehiclePos(GetPlayerVehicleID(playerid),2316.0850,1447.9220,42.4912);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 269.6896);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
} else {
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid,2316.0850,1447.9220,42.4912);
SetPlayerFacingAngle(playerid, 269.6896);
SetCameraBehindPlayer(playerid);
}
} else {
SetPlayerPos(playerid,2316.0850,1447.9220,42.4912);
SetPlayerFacingAngle(playerid, 269.6896);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 0);
}
return 1;
}
Nu ko kad viss gatavs varam likt to skriptā izskatās šādi
Code
#include <a_samp>
#define COLOR_TURQ 0x00A3C0AA
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Tavs FS nosaukums seit - Piem - MultiScript");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/driftlv", true) == 0) {
if(IsPlayerInAnyVehicle(playerid) == 1) {
SetPlayerInterior(playerid, 0);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
SetVehiclePos(GetPlayerVehicleID(playerid),2316.0850,1447.9220,42.4912);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 269.6896);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
} else {
RemovePlayerFromVehicle(playerid);
SetPlayerPos(playerid,2316.0850,1447.9220,42.4912);
SetPlayerFacingAngle(playerid, 269.6896);
SetCameraBehindPlayer(playerid);
}
} else {
SetPlayerPos(playerid,2316.0850,1447.9220,42.4912);
SetPlayerFacingAngle(playerid, 269.6896);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 0);
}
return 1;
}
return 0;
}
Autors [NWA]187