19.08.2015, 17:47
Starting A Game Mode
By Roberto80
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));
so look how,first:
Quote:
Originally Posted by Vince
Stop Abusing Of Stock!
|
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; }
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; }
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; }
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; }
Код:
InfoMessage(playerid,message[]) { new string[200]; format(string,200,"[Info]: {D5D5D5}%s",message); SendClientMessage(playerid,0xEE555500,string); return 1; }
Код:
if (strcmp("/BuyPhone", cmdtext, true, 10) == 0) { InfoMessage(playerid,"You Paid $10000 For Buying Your Phone."); return 1; }
Codes:
Код:
ErrorMessage(playerid,message[]) { new string[200]; format(string,200,"[Error]: {D5D5D5}%s",message); SendClientMessage(playerid,0xEE555500,string); return 1; }
Код:
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!