| RP Tutorialok
__________________________________________________________________________________________________________
RP Nv ellenrz
Ezt tegyk be a modba (rdemes a legaljra)
stock CheckRpName(const name[]){
new length=strlen(name),ch;
for(ch=0; ch<length; ch++) if(name[ch]) break;
if(ch==(length+1)) return false;
for(ch=0; ch<length; ch++) {
if((ch>=2) && (ch<=(length-2))) {
if((name[ch]>='a')&&(name[ch]<='z')||(name[ch]>='A')&&(name[ch]<='Z')||name[ch]=='_') {}
else return false;
}
else {
if(name[ch]=='_') return false;
}
}
return true;
}
Aztn az OnPlayerConnect(playerid)-hez
new player_name[MAX_PLAYER_NAME];
GetPlayerName(playerid,player_name,sizeof player_name);
if(CheckRpName(player_name)) { }
else {
SendClientMessage(playerid,0xAA3333AA,"A neved nem felel meg az RP szabvnynak.");
SendClientMessage(playerid,0xAA3333AA,"Pllda a megfelel nvre: Vezetkneved_Keresztneved");
Kick(playerid);
}
s akkor gy fog kinzni
-
#include <a_samp>
-
public OnPlayerConnect(playerid)
-
{
-
new player_name[MAX_PLAYER_NAME];
-
GetPlayerName(playerid,player_name,sizeof player_name);
-
if(CheckRpName(player_name)) { }
-
else {
-
SendClientMessage(playerid,0xAA3333AA,"A neved nem felel meg az RP szabvnynak");
-
SendClientMessage(playerid,0xAA3333AA,"Vezetkneved_Keresztneved");
-
Kick(playerid);
-
}
-
-
return 1;
-
}
-
stock CheckRpName(const name[]){
-
new length=strlen(name),ch;
-
for(ch=0; ch<length; ch++) if(name[ch]) break;
-
if(ch==(length+1)) return false;
-
for(ch=0; ch<length; ch++) {
-
if((ch>=2) && (ch<=(length-2))) {
-
if((name[ch]>='a')&&(name[ch]<='z')||(name[ch]>='A')&&(name[ch]<='Z')||name[ch]=='_') {}
-
else return false;
-
}
-
else {
-
if(name[ch]=='_') return false;
-
}
-
}
-
return true;
-
}
__________________________________________________________________________________________________________
Beszlgets a kzelben lv jtkosokkal

A fenti kpen lthat a MAX tvolsg a jtkosok kzt. Az ennl tvolabbi jtkosoknak nem kldi el az zenetet.
A mododban tallhat OnPlayerText-et trld ki s ezt rakd be a helyre:
-
public OnPlayerText(playerid, text[])
-
{
-
new Float:x, Float:y, Float:z, str[200], name[MAX_PLAYERS];//trolk
-
for(new i=0;i<MAX_PLAYERS;i++)//sszes jtkosra vonatkozik
-
{
-
if(IsPlayerConnected(i)==1)//csatlakozs
-
{
-
GetPlayerPos(playerid, x, y, z);//lekrjk a sajt pozcinkat
-
if(IsPlayerInRangeOfPoint(i, 7, x, y, z))//ha a tbbiek a mi pozcink kzelbe vannak
-
{
-
GetPlayerName(playerid, name, sizeof(name));//lekrjk a nevnket
-
format(str, sizeof(str), "%s mondja: %s", name, text);//zenet
-
SendClientMessage(i, 0xFFFF00AA,str);//elkldjk a jtkosoknak
-
}
-
}
-
}
-
return 0;
-
}
_________________________________________________________________________________________________________
/me parancs
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/me", true, 3))//parancs
{
if(!cmdtext[3] || !cmdtext[4]) return SendClientMessage(playerid, 0xFF0000FF, "Hasznlat: /me [cselekvs]");
new str[128], name[MAX_PLAYER_NAME];//vltozk
GetPlayerName(playerid, name, sizeof(name));//neved lekrse
format(str, 128, "%s ppen %s", name, cmdtext[3]);//zenet amit trhatsz (a kt %s-t ne trld le ) SendClientMessageToAll(0x1E84D7FF, str);//zenet elkldse
return 1;
}
return 0;
}
N00boknak sszeraktam:Letlts
_________________________________________________________________________________________________
| |
Igazbl ez a /me j csak nem range-es mert mindenki ltja ezt az zenetet s gy nem rps de ez legyen a legkevesebb.