[Tutorial] Starting A GameMode [Basics]
#1

Starting A Game Mode
By Roberto80

Informations:
Hello,i'm Roberto80,you can call me Roe.
In this tutorial,i'm showing you how to start a GameMode (GM) ,its a GM for a RolePlay (RP) server.
i mean with "Basics",how to script a full GM in a easy way!

Part 1:Players Names
As everyone know,we always use GetPlayerName , because the player name is used alot in the GM,we use it for alot of commands,like /me-/do and more...
so why to use this codes in every command?
CODES:
Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
what about to replace all this codes with pName(playerid) ??
so look how,first:
Quote:
Originally Posted by Vince
Stop Abusing Of Stock!
exactly
so no need to use "Stock" before anything...
so look how we can get the player name!!:
Код:
pName(playerid)
{
	new PlayerName[24];
	GetPlayerName(playerid,PlayerName,24);
	return PlayerName;
}
so now,when you want to get the player name,just write " pName(playerid) " ,not just playerid ,it can be giveplayerid or id or any player you want to show his name!
example on this:
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	new string[28];
	format(string,50,"Player Name:%s!",pName(clickedplayerid));
	SendClientMessage(playerid,-1,string);
	return 1;
}
Part 1:Error And Info Messages
In every GM,we have alot of Admin messages! alot of error messages,alot of info messages!
most of admins messages are:"You are not an admin-Your admin level is too low-You are not allowed to use this command"....
most of error messages are:"You don't have enough money-You must exit your vehicle-You can't use this command while jailed"....
most of info messages are:"You bought your first phone! you can use /c <number> - correct usage is:/kick <playerid> <reason>"....
why we always send the same message,with the same codes!!!
we can do some simple things to make script faster!
let's start with admin message!
look at this codes:
Код:
AdminCheck(playerid)
{
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xEE555500,"[Error]:{D5D5D5}You Are Not An Admin!");
	return 1;
}
so now,in each admin command,just add AdminCheck(playerid);
example on it:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/GoToFarm", cmdtext, true, 10) == 0)
	{
		AdminCheck(playerid);
		SetPlayerPos(playerid,0,0,3);
		return 1;
	}
	return 0;
}
now info message,codes:
Код:
InfoMessage(playerid,message[])
{
	new string[200];
	format(string,200,"[Info]: {D5D5D5}%s",message);
	SendClientMessage(playerid,0xEE555500,string);
	return 1;
}
example on it:
Код:
    if (strcmp("/BuyPhone", cmdtext, true, 10) == 0)
	{
	    InfoMessage(playerid,"You Paid $10000 For Buying Your Phone.");
	    return 1;
	}
and now,Error messages,its the same of Admin message but with custom message.
Codes:
Код:
ErrorMessage(playerid,message[])
{
	new string[200];
	format(string,200,"[Error]: {D5D5D5}%s",message);
	SendClientMessage(playerid,0xEE555500,string);
	return 1;
}
Example on it:
Код:
if (strcmp("/BuyPhone", cmdtext, true, 10) == 0)
	{
	    if(GetPlayerMoney(playerid) < 1000) return ErrorMessage(playerid,"You Don't Have Enough Money To Buy A Phone!");
	    InfoMessage(playerid,"You Paid $10000 For Buying Your Phone.");
	    return 1;
	}


Continue Soon When I Find New Ideas,,,,
Thanks For Reading,To Be Continued!
Reply
#2

Nice job man, Good For Beginners
Reply
#3

Very ugly that you are procceeding to use The Shitty Writing We See In GameMode Edits
Reply
#4

Quote:
Originally Posted by SundayMorning
Посмотреть сообщение
Nice job man, Good For Beginners
thanks,yeah it for beginners...
Quote:
Originally Posted by sellize
Very ugly that you are procceeding to use The Shitty Writing We See In GameMode Edits
what are you talking about??
its the best way to start a GM,i saw alot of GM with alot of lines for nothing! just write write write same codes.
i will continue soon with ZCMD and SSCANF2,anyway thanks for reply
Reply
#5

So the gamemode is completed by adding this?

What about classes?
What about admin levels?
What about server basic features?
Where to add the MAP codes?
Much more.

Dude only 0.3/100 is explained, Good try but i suggest you to read sa-mp wiki for the codes and it's functions, On wiki the same functions are well explained.
Reply
#6

Why would you use a function to retrieve player names if you're already storing it in a string? Why use a string size of 200 for your functions to send client messages when the max message size via SendClientMessage is 144?
Reply
#7

Quote:
Originally Posted by Bingo
Посмотреть сообщение
So the gamemode is completed by adding this?

What about classes?
What about admin levels?
What about server basic features?
Where to add the MAP codes?
Much more.

Dude only 0.3/100 is explained, Good try but i suggest you to read sa-mp wiki for the codes and it's functions, On wiki the same functions are well explained.
As i said,its a RP gamemode,so no classes...and i'm just suggesting to use something like this when starting a GM...
Thanks for your comment..
Reply
#8

tbh when i saw the title i thought it'd be a big tutorial but ........... well good job anyways
Reply
#9

I Think!....
This
PHP код:
pName(playerid)
{
    new 
PlayerName[24];
    
GetPlayerName(playerid,PlayerName,24);
    return 
PlayerName;

Should be like this
PHP код:
pName(id)
{
    new 
PlayerName[24];
    
GetPlayerName(id,PlayerName,24);
    return 
PlayerName;

To get any name of any player :3
Reply
#10

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
I Think!....
This
PHP код:
pName(playerid)
{
    new 
PlayerName[24];
    
GetPlayerName(playerid,PlayerName,24);
    return 
PlayerName;

Should be like this
PHP код:
pName(id)
{
    new 
PlayerName[24];
    
GetPlayerName(id,PlayerName,24);
    return 
PlayerName;

To get any name of any player :3
Omg it's the same .. you can put it like that too:

Код HTML:
Name(popcorn)
{
       new pName[MAX_PLAYER_NAME];
       GetPlayerName(popcorn, pName, sizeof(pName));
       return pName;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)