Tuesday, August 18, 2009

Scripting, random stuff

Just wakened up. I thought that i would make a short blog post, so here it goes.

Well, today it's about the RPG script i am creating. It goes along pretty well i think, it feels good to have that scripting status back on. Maybe i should post some scripting snippets while writing it anyways?



stock GetFileLines(File:textfile)
{
new meh[200];
new lines;
while(fread(textfile,meh))
{
lines++;
}
return lines;
}

Example:

new File:hFile = fopen("meh.txt",io_read); //must be read!
new lines = GetFileLines(hFile);
printf("Lines in meh.txt: %d", lines);


stock pName(playerid)
{
new _nick[MAX_PLAYER_NAME];
GetPlayerName(playerid, _nick, MAX_PLAYER_NAME);
return _nick;
}

Example:

new id = strval(params);
SetPlayerName(id,pName(playerid));
//This will cause the /setname to have the commander's name



Well, haven't got anything more to share, i'll come up with other stuff.

Leopard
PS. School starts tomorrow!

No comments:

Post a Comment