Help in Adding player score
#1

I have a dout guys help me !!!!!!!

I have mapped a Challenge but how to make that when any player will end or complete the challenge and earn score and give him money how to script it

I mapped but not know that scriptin how to script....... tell the codes for it and plz expalin in brief i am a newbie
Reply
#2

Create a checkpoint?
Put this ongamemodeinit or onfilterscriptinit.
Код:
        CPNAME = CreateDynamicCP(X, Y, Z, 1.3, -1, 0, -1, 65.0); //create a checkpoint named CPNAME at X Y Z
	Create3DTextLabel("[The Finish!]", COLOR_YELLOW, X, Y, Z + 0.2, 7.5, 0, 1); //Place a message above the checkpoint.
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
 	if(checkpointid == CPNAME) //we named the checkpoint CPNAME so its identified here.
  	{
  	 SendClientMessage(playerid, COLOR_WHITE, "* You completed the challenge!"); // Sending a message.
         SetPlayerScore(playerid, GetPlayerScore(playerid) + 1); // get the players score and add +1
         SendClientMessage(playerid, COLOR_WHITE, "* You gained +1 Score"); // Sending a message.
         GivePlayerMoney(playerid, 1000); // Give the player 1000 Money ontop of his current balance.
  	 SendClientMessage(playerid, COLOR_WHITE, "* You gained $1000 aswell!"); // Sending a message.
	}
Return 1;
}

NOTE this will send the message every time the player enters the checkpoint, so if he walks trough it 5 times he'll gain the reward 5 times, there is no cooldown, if you would like a cooldown, i suggest adding a timer.
Reply
#3

I need to add player pos anywhere to cross cheack point ?

and i sed code so error cam see C:\Users\admin\Desktop\TheUltimate\The Ultimate Freeroam\filterscripts\lolololol.pwn(35) : error 017: undefined symbol "CPNAME"
C:\Users\admin\Desktop\TheUltimate\The Ultimate Freeroam\filterscripts\lolololol.pwn(35) : error 017: undefined symbol "CreateDynamicCP"
C:\Users\admin\Desktop\TheUltimate\The Ultimate Freeroam\filterscripts\lolololol.pwn(36) : warning 217: loose indentation
C:\Users\admin\Desktop\TheUltimate\The Ultimate Freeroam\filterscripts\lolololol.pwn(36) : error 017: undefined symbol "COLOR_YELLOW"
C:\Users\admin\Desktop\TheUltimate\The Ultimate Freeroam\filterscripts\lolololol.pwn(39) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#4

go ingame, at the finish type /save CPHERE
exit the game, go to your samp user files, open savedpositions.txt
Look at the line that says CPHERE at the end,
AddPlayerClass(0,2316.6211,-7.2592,26.7422,270.8005,0,0,0,0,0,0); //CPHERE
For example.

COPY 2316.6211,-7.2592,26.7422

and replace X, Y, Z with that.

at both the createcheckpoint and create3dtextlabel.
So something like ..

CPNAME = CreateDynamicCP(2316.6211,-7.2592,26.7422, 1.3, -1, 0, -1, 65.0); //create a checkpoint named CPNAME at X Y Z
Create3DTextLabel("[The Finish!]", COLOR_YELLOW, 2316.6211,-7.2592,26.7422+ 0.2, 7.5, 0, 1); //Place a message above the checkpoint.
Reply
#5

This is why, yvoms, you should know better than to simply paste up code... This is Scripting Help, not script-for-you.

By simply pasting up code, then when it fails he'll come back constantly asking for more, then when someone turns him down and points out the guidelines of this section, there'll be a hassle.

More from those who don't understand the rules, and will simply keep pasting up code.


He's better to be taught how, rather than simply having code pasted up for him... He'll learn to copy-paste, rather than code, and that, isn't what this forum is actually for.
Reply
#6

Maybe your right sew_sumi, but in a different way,
he also may learn from this since i elaborated the function after the actual execution hehe,
Thats how i have learned myself to be honest,
Im not a master at pawno, but i think i know the basics.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)