simplifying
#1

just wondring is there any way to simplify this


Code:
	dcmd_drift(playerid, params[])
	{
		new pName[MAX_PLAYER_NAME];
		new tString[128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
		SetPlayerPos(playerid,-307.062805,1538.853515,78.099159);
		format(tString, sizeof(tString), "(News) %s has teleport to drift do /drift to join",pName);
 		SendClientMessageToAll(COLOR_DARKGREEN, tString);
		GameTextForPlayer(playerid,"Welcome to drift",2500,3);
		#pragma unused params
		return 1;
  }
Reply
#2

Quote:
Originally Posted by dlegend
just wondring is there any way to simplify this


Code:
	dcmd_drift(playerid, params[])
	{
		new pName[MAX_PLAYER_NAME];
		new tString[128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
		SetPlayerPos(playerid,-307.062805,1538.853515,78.099159);
		format(tString, sizeof(tString), "(News) %s has teleport to drift do /drift to join",pName);
 		SendClientMessageToAll(COLOR_DARKGREEN, tString);
		GameTextForPlayer(playerid,"Welcome to drift",2500,3);
		#pragma unused params
		return 1;
  }
well u got 50 characters in ur string + the name which can be max 20
so new tString[128]
only needs to be new tString[70];

and u could use
instead of MAX_PLAYER_NAME in GetPlayerName
sizeof(pName)

but to "simplify it there ain'T much more.
Reply
#3

ok thanks alot man jw thats all
Reply
#4

Your variable pName is useless, you can use tString to store the player's name.
Reply
#5

im not that good so how do i do that
Reply
#6

Quote:
Originally Posted by dlegend
im not that good so how do i do that
Example:
pawn Code:
new tString[80];
GetPlayerName(playerid, tString, MAX_PLAYER_NAME);
format(tString, sizeof(tString), "(News) %s has teleport to drift do /drift to join", tString);
SendClientMessageToAll(0xFFFFFFAA, tString);
Reply
#7

thanks dom
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)