Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cycu

Pages: 1 [2]
16
mIRC/pawn Scripting / Re: HELP NEEDED GUYS!!!
« on: March 26, 2011, 09:13:43 pm »
Code: [Select]
if (strcmp(cmd, "heal", true) == 0)
{
new
tmp[20],
id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
SetPlayerHealth(id, 100.0);
SendClientMessage(id, 0x00FF00AA, "You have been healed");
SendClientMessage(playerid, 0x00FF00AA, "Player healed");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
}
return 1;
}

And at the end of the script you have to add strtok definition:

Code: [Select]
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
I recommend looking into SA-MP wiki there is a lot useful stuff about pawn.

You can find the command and explanation here:

http://wiki.sa-mp.com/wiki/Strtok

I wish someone re defined dcmd for vc-mp  ::)

17
mIRC/pawn Scripting / Re: Help needed please
« on: March 24, 2011, 05:37:41 pm »
There can be some typos in this, done really quickly.

http://pastebin.com/vSXv1hqc

Now if you want to make it even cooler add another timer which will check if the player is in the radius of the bomb site, which will prevent from typing /c defuse and letting player to defuse bomb anywhere he wants.

I hope this helped ;).

Pages: 1 [2]