AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why this doesnt work? (https://forums.alliedmods.net/showthread.php?t=207149)

Kz1.0 01-30-2013 10:44

Why this doesnt work?
 
I have this code, the print is ok but the set_pev doesn't work :(.
PHP Code:

public event_new_round() 
{
hour 7
set_task
(20.0"hour_plus"_,_,_"a"15)
set_task(20.0"checkFree"_,_,_"a"15)
_UpdateHud()
}

public 
checkFree(id)
switch (
hour)
{
case 
121318192021:
{
client_print(idprint_chat"TEST 1"//print chat ok but the model doesn't change
set_pev(idpev_body2)
//entity_set_int(id, EV_INT_skin, 3)
}

default:
{
client_print(idprint_chat"TEST 2")
set_pev(idpev_body3)
//set_pev(id, pev_skin, 0)
}



Xalus 01-30-2013 11:08

Re: Why this doesnt work?
 
public checkFree(id)

This ID is zero.

Kz1.0 01-30-2013 11:09

Re: Why this doesnt work?
 
but why the cleint_print still works, and if so, what i have to do :)

Backstabnoob 01-30-2013 11:12

Re: Why this doesnt work?
 
because if client_print's first argument is zero (which it is in this case), it shows the message to all players.

If you want to change the pev for each player like that, you need to loop through all players in the task.

Kz1.0 01-30-2013 11:29

Re: Why this doesnt work?
 
Like this ??
PHP Code:

new players[32
new 
max_players
get_players
(playersmax_players"a");

for (new 
imax_playersi++)
{
        
set_pev(players[i], pev_body1)
        
//....



Backstabnoob 01-30-2013 11:33

Re: Why this doesnt work?
 
yes

Kz1.0 01-30-2013 12:04

Re: Why this doesnt work?
 
Works fine, thanks you guys for quick and helpful replies :)

wickedd 01-30-2013 12:26

Re: Why this doesnt work?
 
Don't delete your post.

Xalus 01-30-2013 12:30

Re: Why this doesnt work?
 
Quote:

Originally Posted by wickedd (Post 1883551)
Don't delete your post.

Now we know, we never gotta help him again in the future ;)

YamiKaitou 01-30-2013 19:24

Re: Why this doesnt work?
 
Post restored, do not blank your posts


All times are GMT -4. The time now is 20:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.