I need help with this! -
Cjgogo - 09.05.2011
I need help about 2 things:
1)First:How to make multiple checkpoints (I have Incognitos stremaer)--Don't understand worng the question I know how to add multiple checkpoints but how to make so that if a player enteres a checkpoint it show different things for evry checkpoint that he enteeres(not same thing for evry checkpoint)
2)How to make a heal(healing another player)command(I tried to make this but even if it doesn't give me compiling errors it's not working in--game):
pawn Код:
{
new gTeam1[MAX_PLAYERS];
if(gTeam1[playerid] == TEAM_MEDICS)
{
if(IsPlayerConnected(playerid))
{
new tmp[256];
new idx;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,RED,"USAGE: /heal [playerid]");
return 1;
}
new player1;
player1 = ReturnUser(tmp);
if(IsPlayerConnected(player1))
{
if(player1 != INVALID_PLAYER_ID)
{
SetPlayerHealth(player1,100);
GivePlayerMoney(playerid,300);
GivePlayerMoney(playerid,-300);
new pn1[24], medicname[24];
GetPlayerName(player1,pn1,sizeof(pn1));
GetPlayerName(playerid,medicname,sizeof(medicname));
new string[128];
format(string,sizeof(string),"%s has been healed by medic %s.",pn1,medicname);
SendClientMessageToAll(GREEN,string);
}
}
}
}
}
Mainly better script it for me so I can use it as example(It almost gave me a bad head ache looking on ****** how to make this I ended up by making it myself).
NEED HELP(ABOUT BOTH THINGS)!!!
Re: I need help with this! -
dannyk0ed - 09.05.2011
pawn Код:
command(heal, playerid, params[])
{
new id, healreqprice, string[128];
if(sscanf(params, "ud", id, healreqprice))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /heal [playerid] [healprice]");
}
else
{
if(IsPlayerConnectedEx(id) && id != playerid)
{
if(Groups[Player[playerid][Group]][CommandTypes] == 3)
{
if(healreqprice >= 1000 || healreqprice < 1)
{
SendClientMessage(playerid, WHITE, "The maximum heal price is $1000, you also can't go lower than $1.");
}
else
{
if(GetDistanceBetweenPlayers(id, playerid) < 5)
{
new Float: Health, HealthInt;
GetPlayerHealth(id, Health);
HealthInt = floatround(Health, floatround_ceil);
if(HealthInt >= 100)
{
SendClientMessage(playerid, WHITE, "That person already has full health.");
}
else
{
format(string, sizeof(string), "%s has requested to heal you, for $%d (type /approve healrequest to approve the request).", GetName(playerid), healreqprice);
Player[playerid][AttemptingToHeal] = id;
Player[id][HealPrice] = healreqprice;
SendClientMessage(id, ANNOUNCEMENT, string);
format(string, sizeof(string), "You have requested to heal %s, for $%d. Wait for them to approve it.", GetName(id), healreqprice);
SendClientMessage(playerid, WHITE, string);
}
}
else
{
SendClientMessage(playerid, WHITE, "You're not close enough to that player.");
}
}
}
else
{
SendClientMessage(playerid, WHITE, "Invalid ID, or that's you.");
}
}
}
return 1;
}
Re: I need help with this! -
Vince - 09.05.2011
First: Using large bold blue text is not gonna get you anymore help. In fact, it is annoying as hell and it makes you look like a total moron.
Second: Checkpoints: Assign ID's to the checkpoints:
pawn Код:
new myCP; // Global var
myCP = CreateDynamicCP(...); // GameModeInit
public OnPlayerEnterDynamicCP(...)
{
if(cpid == myCP)
{
// do stuff
}
}
Third: You still haven't learned from your mistakes, because I mentioned this exact same problem in one of your previous topics. Do you understand what you are doing here?
pawn Код:
new gTeam1[MAX_PLAYERS];
if(gTeam1[playerid] == TEAM_MEDICS)
{
When that
gTeam1 array is created there, all indices will always be zero. And unless you defined TEAM_MEDICS as zero, this code won't work. Move that array to your global variables and assign the teams appropriately.
Re: I need help with this! -
Cjgogo - 09.05.2011
please I asked for strcmp...(also thanks but there has to be a way to do it with
STRCMP or maybe there isn't??:O(I don't think so)
Re: I need help with this! -
Cjgogo - 09.05.2011
thanks vince appreaciate help but i still need help then with the command ok I'll remove 1(as a global array that I defined is gTeam)so now what's the command if only someone had posted an example I could follow it for evry command that I'll script